View source: R/snapPointsToLines_v2.R
snapPointsToLines_v2 | R Documentation |
This function snaps a set of points to a set of lines based on the minimum distance of each point to any of the lines. This function does not work with geographic coordinates. This function replaces the maptools::snapPointsToLines because it stopped working correctly
snapPointsToLines_v2( points, lines, maxDist = 0.1, withAttrs = TRUE, idField = NA )
points |
An object of the class SpatialPoints or SpatialPointsDataFrame. |
lines |
An object of the class SpatialLines or SpatialLinesDataFrame. |
maxDist |
Numeric value for establishing a maximum distance to avoid snapping points that are farther apart; its default value is NA. |
withAttrs |
Boolean value for preserving (TRUE) or getting rid (FALSE) of the original point attributes. Default: TRUE. This parameter is optional. |
idField |
A string specifying the field which contains each line's id. This id will be transferred to the snapped points data set to distinguish the line which each point was snapped to. |
SpatialPointsDataFrame object as defined by the R package 'sp'. This object contains the snapped points, therefore all of them lie on the lines.
Kevin See
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.