Geospatial Modelling Environment

sampleperppointsalonglines (Sample Perpendicular Points Along Lines)

Creates sets of points sampled at a regular intervals along lines, and perpendicular to them


This tool creates sets of points sampled at a regular intervals (distance d) along lines. The points are oriented perpendicular to the line at the line sample point, and are placed symmetrically on both sides of the line. The number of perpendicular points to sample, and the distances at which they should be placed (distances p), can be specified by the user. The line sample point that acts as the origin from which the perpendicular points are placed can also optionally be included in the output point data source.

The tool processes lines sequentially. For each line a random start distance in the interval [0,d] is identified (although this can be overridden with the ‘start’ parameter, which allows you to specify a constant initial distance – often 0). At that point a set of potential sample points is generated based on the set of perpendicular distances specified (p). This set of potential sample points is tested to ensure that each point is at least distance max(p) away from any line other than the current sample line, and distance max(p) away from any other generated sample point. If the user has specified the optional exclusion polygon data source the points are also tested to ensure none fall within one of these polygons. If any point in the set of perpendicular points fails one of these tests, the set is discarded. Otherwise, the points are accepted and written to the output data source. The algorithm then moves to the next point at distance +d along the line (taking into account any vertices and changes in direction along the line), and the process is repeated until the end of the line is reached.

The tool writes several ID fields to the output table that define the different levels of organisation in the data. First, the unique line ID field specified by the user is written to the point dataset so that sample points can be tied to the lines from which they were generated. Second, every output point has a unique integer ID (field PNTID). Third, each complete set of points has a unique ID (field SETID). Fourth, the perpendicular stratum of sampling is also assigned an integer ID number (field STRATUM): 0 for the line sample point (if it is included in the output), and then a sequence of numbers beginning at 1 corresponding to each perpendicular distance. If only one distance is specified, a pair of points is generated, and this unique ID will be 1. If two distances are specified, four points are generated, the inner two with an ID of 1, and the outer two with an ID of 2, and so on.

The screening of sample points to ensure minimum distances are maintained adds substantially to processing times. This feature is disabled by default but can be activited using the ‘screen=TRUE’ parameter. If you are interested in this screening, it is recommended that you first run the command without the screening to ensure that the output is consistent with your expectations. Then re-run the command with a different output file and the screening switched on.

The speed of processing will benefit from ensuring that i) all input spatial data sources have the spatial references explicitly defined, and ii) a spatial index has been built on the input line data source and the exclusion polygon data source if specified. No attempt should be made to access these input data sources while processing is occurring. Processing speeds will also be improved by removing any excess lines from the input line data source, or excess polgons from the exclusion polygon data source (if specified). Spatial indices should be built or rebuilt after removing excess polygons.


sampleperppointsalonglines(in, uidfield, out, interval, linedistance, [excl], [linepoint], [screen], [start]);

inthe input line data source containing lines along which perpendicular samples are generated
uidfieldthe input line data source unique integer ID field
outthe output point data source
intervalthe constant interval distance along each line at which sets of sample points are generated, or the name of a field in the input line data source containing this value for each line, e.g. 100 or “SDIST”
linedistancethe perpendicular distance(s) from each line at which sample points are generated
[excl]a polygon data source within which points are not permitted to be generated
[linepoint](TRUE/FALSE) if true, includes the origin point on the input line in the output data point data source (default=FALSE)
[screen](TRUE/FALSE) if true, screens sample points to ensure that the maximum linedistance is maintained among points and lines (default=FALSE)
[start]specifies the start distance of the first sample (default is a random start in the interval 0-interval)


sampleperppointsalonglines(in=”C:datafences.shp”, uidfield=”FENCEID”, out=”C:datasamples.shp”, interval=1000, linedistance=500, linepoint=F, screen=T);

sampleperppointsalonglines(in=”C:dataroads.shp”, uidfield=”RDID”, out=”C:datasamples.shp”, interval=1000, linedistance=c(100,500,1000), linepoint=T, screen=F);

sampleperppointsalonglines(in=”C:datafences.shp”, uidfield=”FENCEID”, out=”C:datasamples.shp”, excl=”C:dataponds.shp”, interval=100, linedistance=c(10,20,30,40,50), linepoint=T, screen=F, start=0);


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