Geospatial Modelling Environment

genstratrandompnts (Generate Stratified Random Points)

Generates a sample of stratified random points (where strata are polygons), with various optional constraint parameters


This tool generates a sample of stratified random points where the strata are polygons. The command options can be combined in a variety of ways to produce different sampling outcomes. Although this tool is therefore very flexible, care must be taken to ensure that the parameters specified to not result in a problem that has no solution.

For each polygon in a polygon data source this tool will generate a sample of random points. The number of points generated can be a constant or variable between polygons. In the latter case the number of points to generate per polygon must be stored in a field in the polygon attribute table.

Points are generated using a simple rejection method algorithm: potential points are generated within the rectangular boundary that defines each polygon based on a bivariate uniform random distribution. They are then accepted if they conform to the acceptance criteria the user has defined.

The 'mindist' option will ensure that all output points are this minimum distance apart. This value should be specified in coordinate system units (e.g. meters for UTM). If this value is too large then the problem may have no solution. For example. it is not possible to generate 100 points in a square kilometer where the minimum distance between points is 500m.

The 'excl' option can be used to prevent points from being generated within the polygons of this dataset. For example, if you were to generate forest sampling points using a stand polygon layer, you might use a second polygon layer representing a 100m buffer of roads as the exclusion layer to prevent points from occurring too close to roads. Again, there is a risk here of creating an unsolvable problem: if the exclusion polygons cover all of the input polygons then no random points can be generated.


genstratrandompnts(in, uidfield, sample, out, [mindist], [excl], [where]);

inthe input polygon data source
uidfieldthe name of the unique polygon ID field
samplethe sample size: either a number representing the sample size per strata, or the field name of field containing the sample size per polygon, e.g. 100 or "NSAMPLES"
outthe output point data source
[mindist]if specified, points are prevented from occurring within this minimum distance of each other (specified in coordinate system units of the reference layer); this option can be dangerous - see the help documentation for details
[excl]the polygon data source containing exclusion polygons: points are prevented from being generated within these polygons; this option can be dangerous - see the help documentation for details
[where]the selection statement that will be applied to the feature data source to identify a subset of features to process (see full Help documentation for further details)


genstratrandompnts(in="C:\data\fields.shp", sample=1000, uidfield="FLDID", out="C:\data\samplepnts.shp");

genstratrandompnts(in="C:\data\plots.shp", sample=1000, uidfield="PLOTID", out="C:\data\samplepnts.shp", mindist=50, excl="C:\data\lakes.shp");


Please consider making a purchase to support the continued development of these tools  Read more...

An apology for failing to respond to correspondence in recent months  Read more...

Tips on how to use this interface efficiently 

Sign up for the newsletter if you wish to receive notification of updates, new functionality, bug fixes, and other related news


Open Source GIS

Copyright © 2001-2012 Hawthorne L. Beyer, Ph.D., Spatial Ecology LLC    Connect on LinkedIn