Geospatial Modelling Environment

snappoints (Snap Points To Features)

Snaps a set of input point points to the features in a vector layer (containing points, lines or polygons) and writes the result to a new point dataset


This tool snaps a set of input points to the features in a vector layer (containing points, lines or polygons). The output is a new point dataset, and the attributes from the input dataset are copied to the output dataset. You must specify a tolerance that controls whether the snap is allowed. If snapping a feature would result in moving the point greater than the tolerance distance then the snap does not take place and the original unsnapped point is written to the output dataset. This snap tolerance allows you to control whether only small snaps are allowed (thereby just tweaking an existing dataset) or to snap all the features by setting the tolerance to a large number.

Note that the larger the tolerance value, the longer it will take to process each record (because the algorithm must search through a greater number of features within that tolerance radius to find the closest one). So if you are concerned about processing time a good strategy is to set the tolerance no larger than it really needs to be. For instance, if you know that there are no points greater than about 2500m from a line, then setting the tolerance to 3000 will accomplish the same thing as setting it to 10000, but it will do so more quickly.

It is recommended that you specify a new dataset as the output dataset. Although you can specify an existing dataset, you must ensure that any fields having the same name in both the input point dataset and the output dataset are of the same type.

An additional field (SNAPDST) is added to the output dataset that records the distance the point was moved. If the point was not moved then this field records a value of -999 (NoData). If a field SNAPDST already exists (because it was already in the input point attribute table, perhaps as a result of using the snappoints command previously) then the algorithm will find a new unique SNAPDST field by adding a number to the end (1, 2, ...) until it finds a unique name.


snappoints(in, snap, out, tol, [where]);

inthe input point data source
snapthe input feature source to which points are snapped
outthe output point data source
tolthe maximum snap distance in coordinate system units
[where]the selection statement that will be applied to the point feature data source to identify a subset of points to process (see full Help documentation for further details)


snappoints(in="C:\data\locs.shp", snap="C:\data\roads.shp", out="C:\data\snappedlocs.shp", tol=5000);

snappoints(in="C:\data\locs.shp", snap="C:\data\lakes.shp", out="C:\data\shorepnts.shp", tol=250);


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