Available with Geostatistical Analyst license.

## Summary

Generates a set of sample points based on inclusion probabilities, resulting in a spatially balanced sample design. This tool is generally used for designing a monitoring network by suggesting locations to take samples, and a preference for particular locations can be defined using an inclusion probability raster.

## Usage

The input probability raster must contain only values between 0 and 1. The higher the value, the more likely the cell will be included in the sample design.

All values in the study area should have inclusion probabilities >= 0, while all areas outside the study area should have Null values.

The cell size of the inclusion probability raster determines the finest resolution at which samples will be generated. In other words, the points the tool creates will always be located at the centers of the raster cells. Using a smaller cell size for the inclusion probability raster will result in more possible locations for the points to be created.

When point, line, or polygon features are converted to raster (to obtain the input probability raster), the following should be considered:

- The cell size (resolution) should be fine enough to distinguish all the important features in the population. To accomplish this, the cell size can be set to less than half the minimum distance between features. This distance can be calculated with Generate Near Table tool.
- For line and polygon features, the cell size should be set so features (such as meandering streams) are adequately represented in the resulting raster. For example, you may not be able to represent a complex river with a large raster cell size; curves in the river may be smoothed over if the cell size is too large.
- The precision with which sample locations can be located in the field should also be considered. For example, if locations are to be found using a GPS with a positional accuracy of 10 meters, then the cell size should be 10 meters.
- Be mindful of the size of the inclusion probability raster, as the number of cells increases, the processing time will also increase.

To avoid outputs that appear spatially unbalanced, it is recommended that the number of sample locations be less than 1 percent of the number of cells in the inclusion probability raster.

This tool uses a random number generator in its operation. The Seed value used can be controlled in the Random number generator environment.

- If a seed value of 0 is used (the default value), then each time the tool is run, a different set of random numbers will be used and a different output will be generated.
- If the random number seed is set to a fixed number greater than 0, then the tool will produce the same set of sample locations each time it is run, until the seed value is changed. Setting the random number seed value to a fixed number > 0 is useful when you want to generate candidate sampling networks so you can choose the one that works best for your needs.

## Syntax

CreateSpatiallyBalancedPoints_ga (in_probability_raster, number_output_points, out_feature_class)

Parameter | Explanation | Data Type |

in_probability_raster | This raster defines the inclusion probabilities for each location in the area of interest. The location values range from 0 (low inclusion probability) to 1 (high inclusion probability). | Raster Layer; Mosaic Layer |

number_output_points | Specify how many sample locations to generate. | Long |

out_feature_class | The output feature class contains the selected sample locations and their inclusion probabilities. | Feature Class |

## Code sample

##### CreateSpatiallyBalancedPoints example 1 (Python window)

Create a set of spatially balanced points based on an input inclusion probability raster.

```
import arcpy
arcpy.env.workspace = "C:/gapyexamples/data"
arcpy.CreateSpatiallyBalancedPoints_ga("ca_prob", "10", "C:/gapyexamples/output/csbp")
```

##### CreateSpatiallyBalancedPoints example 2 (stand-alone script)

Create a set of spatially balanced points based on an input inclusion probability raster.

```
# Name: CreateSpatiallyBalancedPoints_Example_02.py
# Description: This tool generates a set of sample points based on inclusion
# probabilities. The resulting sample design is spatially balanced, meaning
# that the spatial independence between samples is maximized, making the
# design more efficient than sampling the study area at random.
# Requirements: Geostatistical Analyst Extension
# Import system modules
import arcpy
# Set environment settings
arcpy.env.workspace = "C:/gapyexamples/data"
# Set local variables
inProb = "ca_prob"
numberPoints = 10
outPoints = "C:/gapyexamples/output/csbp"
# Execute CreateSpatiallyBalancedPoints
arcpy.CreateSpatiallyBalancedPoints_ga(inProb, numberPoints, outPoints)
```

## Environments

## Licensing information

- ArcGIS Desktop Basic: Requires Geostatistical Analyst
- ArcGIS Desktop Standard: Requires Geostatistical Analyst
- ArcGIS Desktop Advanced: Requires Geostatistical Analyst