Documentation > Explore > Samplings
Geosimulation models, in the broad sense of simulation models in which the spatial configuration of agents plays a significant roles in the underlying processes (think e.g. of spatial interaction models), are generally tested for sensitivity on processes or agents parameters, but less frequently on the spatial configuration itself.
A recent paper proposed the generation of synthetic spatial configurations as a method to test the sensitivity of geosimulation models to the initial spatial configuration.
Some complementary work (paper) focused on similar generator at larger scales, namely generators for building configurations at the scale of the district.

More generally, the spatial data library developed by the OpenMOLE team integrates these kind of methods in a larger context, including for example synthetic spatial networks and perturbation of real data, but also spatial interaction models and urban dynamics models.

Some of the corresponding spatial generators are included in OpenMOLE as

where

with the specific parameters as factors for generator parameters:

A binary grid resembling a labyrinthine building organisation, obtained by percolating a grid network (see details in paper). It percolates a grid network until a fixed number of points on the boundaries of the world are linked through the giant cluster. The resulting network is transposed to a building configuration by assimilating each link to a street with a given width as a parameter.

with

A first simple generator for polycentric population densities uses an exponential mixture:

where

with

## Contents

More generally, the spatial data library developed by the OpenMOLE team integrates these kind of methods in a larger context, including for example synthetic spatial networks and perturbation of real data, but also spatial interaction models and urban dynamics models.

Some of the corresponding spatial generators are included in OpenMOLE as

*Spatial Samplings*. In the current development version, only some grid generators are included, for a reason of types for output prototypes (synthetic networks are difficult to represent as simple types and to feed as inputs to models). All generators output the generated grids in a provided prototype, along with the generation parameters for the generators taking factors as arguments.

## Random grid sampling ðŸ”—

A raster with random values:```
val grid = Val[Array[Array[Double]]]
RandomSpatialSampling(
samples,
worldSize,
density in Range(0.0, 1.0),
grid)
```

where

`samples`

is the number of grids to generate,`worldSize`

is the width of the generated square grid,- the factor for a density parameter is optional and produces a binary grid of given density in average if provided,
`prototype`

is the prototype for the generated grid (must be a`Val[Array[Array[Double]]]`

since the grid is represented as raster data).

## Blocks grid sampling ðŸ”—

A binary grid with random blocks (random size and position). With the same arguments as before, except the factors for the generator parameters:`blocksNumber`

is the number of blocks positioned, `blocksMinSize`

/`blocksMaxSize`

minimal/maximal (exchanged if needed) width/height of blocks, each being uniformly drawn for each block.
```
val grid = Val[Array[Array[Double]]]
BlocksGridSpatialSampling(
samples,
worldSize,
blocksNumber in Range(1.0, 20.0),
blocksMinSize in Range(1.0, 10.0),
blocksMaxSize in Range(2.0, 30.0),
grid)
```

## Thresholded exponential mixture sampling ðŸ”—

A binary grid created with an exponential mixture, with kernels of the form`exp(-r/r0)`

. A threshold parameter is applied to produce the binary grid.
```
val grid = Val[Array[Array[Double]]]
ExpMixtureThresholdSpatialSampling(
samples,
worldSize,
expMixtureCenters in Range(1.0,20.0),
expMixtureRadius in Range(1.0,10.0),
expMixtureThreshold in Range(2.0,30.0),
grid)
```

with the specific parameters as factors for generator parameters:

`expMixtureCenters`

the number of kernels,`expMixtureRadius`

the range of kernels,`expMixtureThreshold`

the threshold to produce the binary grid.

## Percolated grid sampling ðŸ”—

**USE WITH CAUTION - SOME PARAMETER VALUES YIELD VERY LONG GENERATION RUNTIME**

A binary grid resembling a labyrinthine building organisation, obtained by percolating a grid network (see details in paper). It percolates a grid network until a fixed number of points on the boundaries of the world are linked through the giant cluster. The resulting network is transposed to a building configuration by assimilating each link to a street with a given width as a parameter.

```
val grid = Val[Array[Array[Double]]]
PercolationGridSpatialSampling(
samples,
worldSize,
percolationProba in Range(0.1,1.0),
percolationBordPoints in Range(1.0,30.0),
percolationLinkWidth in Range(1.0,5.0),
grid)
```

with

`percolationProba`

the percolation probability,`percolationBordPoints`

the number of points on the bord of the grid to belong to the giant cluster,`percolationLinkWidth`

the width of the final streets.

## Exponential mixture population grid sampling ðŸ”—

At a smaller scale than the previous generators which are all binary grids (building configurations), population density grids can be considered at the metropolitan scale for example (a grid cell being of width 1km for example).A first simple generator for polycentric population densities uses an exponential mixture:

```
ExponentialMixtureSpatialSampling(
gridSize,
centersNumber,
maxValue,
kernelRadius,
samples,
prototypes
)
```

where

`gridSize`

is the dimension of the world as`Either[Int, (Int, Int)]`

,`centersNumber`

is an integer giving the number of kernels,`maxValue`

is optional (default to 1) and can be either a double giving the intensity at the center of each kernel, or a sequence of doubles giving the intensity for each kernel,`kernelRadius`

is also optional and specifies similarly either all radius or the sequence of radius,`samples`

is the number of grids to generate,`prototypes`

is an arbitrary number of prototypes for the generated layers (must be of the same size as provided parameters if in sequence mode). */

## Reaction diffusion population grid sampling ðŸ”—

Urban morphogenesis model for population density introduced by (Raimbault, 2018).**USE WITH CAUTION - SOME PARAMETER VALUES YIELD VERY LONG GENERATION RUNTIME**

```
val grid = Val[Array[Array[Double]]]
ReactionDiffusionSpatialSampling(
samples,
gridSize,
grid,
alpha,
beta,
nBeta,
growthRate,
totalPopulation
)
```

with

`samples`

number of grids to generate,`gridSize`

width of the square grid,`prototype`

the prototype for the generated grid,`alpha`

strength of preferential attachment,`beta`

strength of diffusion,`nBeta`

number of times diffusion is operated at each time step,`growthRate`

number of population added at each step,`totalPopulation`

the final total population.

## OpenStreetMap buildings sampling ðŸ”—

*Currently being implemented*