Geospatial Modelling Environment

gencondrandompnts (Generate Conditional Random Points)

Generates a sample of random points around each input point, designed for a conditional logistic regression (case controlled) style of analysis


This tool generates a sample of random points that are associated with each point in an input point data source. 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 point in a point data source this tool will generate a sample of random points based on that points spatial location and a sampling distribution you specify. The number of points generated can be a constant or variable between points. In the latter case the number of points to generate per polygon must be stored in a field in the point attribute table.

Points are generated by drawing from a bivariate distribution. Two distributions are currently supported: BVUNIFORM, and BVNORMAL. In the case of BVUNIFORM, if you specify a single parameter this is assumed to represent the radius of the circle centred on the source point within which uniformly distributed sample points are generated (this distance should be specified in coordinate system units, e.g. meters for UTM). However, if two parameters are specified then points are generated within a ‘donut’ shape centred on the source point, i.e. the first parameter defines the radius of the circle that is the inside of the donut, and the second value defines the radius of the circle that is the outside of the donut.

In the case of the BVNORMAL distribution the single parameter represents the standard deviation of the distribution in both the x and y directions (assumed to be the same, with no covariance). The ‘mvrnorm’ function in the MASS library in R is used to generate these bivariate normal values. To specify the distributions you would either type ‘c(“BVUNIFORM”, value)’ or ‘c(“BVUNIFORM”, value, value)’ or ‘c(“BVNORMAL”, value)’, where the word value is replaced by the radius or variance respectively.

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.


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

inthe input point data source
uidfieldthe name of the unique point ID field in the input data source
samplethe sample size: either a number representing the constant sample size per input point, or the field name of field containing the sample size for that point
distribthe sampling distribution, either c(“BVUNIFORM”, radius) or c(“BVUNIFORM”, radius1, radius2) or c(“BVNORMAL”, variance) (see full help documentation for details)
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)


gencondrandompnts(in=”C:datalocations.shp”, uidfield=”LOCID”, sample=10, distrib=c(“BVUNIFORM”,100), out=”C:datacondsamplepnts.shp”);

gencondrandompnts(in=”C:datalocations.shp”, uidfield=”LOCID”, sample=”SAMPSIZE”, distrib=c(“BVNORMAL”,29.6), out=”C:datacondsamplepnts.shp”);


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

Tips on how to use this interface efficiently 


Open Source GIS

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