Skip to main content
Spatially stratified sampling partitions the data into a grid and randomly samples each partition independently.

spatially_stratified_sample

Spatially stratified sampling of a DataFrame containing spatial data. Each dimension will be rounded to the nearest integer.

Parameters

DataFrame
required
DataFrame containing spatial data to be sampled. Must contain a geometry column.
float
required
Sampling rate between 0 and 1
int
required
Number of partitions to divide the data into. If not a perfect square, the number of partitions
Optional[str]
Column containing the geometry data. Default is “geometry”
int
required
Seed for sampling the data

Returns

The input DataFrame sampled down to the specified rate.

Usage Examples