View source: R/geometrical_functions_sf.R
snapPointsToLines2 | R Documentation |
Snap points to their nearest lines (edited from maptools)
snapPointsToLines2(points, lines, idField = NA, ...)
points |
A feature collection of points |
lines |
A feature collection of linestrings |
idField |
The name of the column to use as index for the lines |
... |
unused |
A feature collection of points with the projected geometries
# reading the data
data(mtl_network)
data(bike_accidents)
mtl_network$LineID <- 1:nrow(mtl_network)
# snapping point to lines
snapped_points <- snapPointsToLines2(bike_accidents,
mtl_network,
"LineID"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.