find_snap | R Documentation |
Finds the snapped location of points on R5
network. Snapping is a very
important step of the routing process, which is when the origins and
destinations specified by the user are actually positioned on the network
created by R5
. The snapping process in R5
is composed of two rounds.
First, it tries to snap the points within a radius of 300 meters from
themselves. If the first round is unsuccessful, then R5
expands the search
radius to 1.6 km. If yet again it is unsuccessful, then the unsnapped points
won't be used during the routing process. The snapped location of each point
depends on the transport mode set by the user, because some network edges
are not available to specific modes (e.g. a pedestrian-only street cannot be
used to snap car trips).
find_snap(r5r_core, points, mode = "WALK")
r5r_core |
An object to connect with the R5 routing engine, created with
|
points |
Either a |
mode |
A string. Which mode to consider when trying to snap the points
to the network. Defaults to |
A data.table
with the original points, their respective
snapped coordinates on the street network and the Euclidean distance ( in
meters) between the original points and their snapped location. Points that
could not be snapped show NA
coordinates and found = FALSE
.
Other network functions:
street_network_to_sf()
,
transit_network_to_sf()
library(r5r)
path <- system.file("extdata/poa", package = "r5r")
r5r_core <- setup_r5(data_path = path)
points <- read.csv(file.path(path, "poa_hexgrid.csv"))
snap_df <- find_snap(r5r_core, points, mode = "WALK")
stop_r5(r5r_core)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.