osrmNearest {osrm} | R Documentation |
Get the Nearest Point on the Street Network
Description
This function interfaces with the nearest OSRM
service.
Usage
osrmNearest(
loc,
exclude,
osrm.server = getOption("osrm.server"),
osrm.profile = getOption("osrm.profile")
)
Arguments
loc |
a point to snap to the street network.
If |
exclude |
pass an optional "exclude" request option to the OSRM API. |
osrm.server |
the base URL of the routing server. |
osrm.profile |
the routing profile to use, e.g. "car", "bike" or "foot". |
Value
The output of this function is an sf POINT of the point on the street
network.
It contains 2 fields:
id, the point identifierv
distance, the distance in meters to the supplied input point.
Examples
## Not run:
library(sf)
apotheke.sf <- st_read(system.file("gpkg/apotheke.gpkg", package = "osrm"),
quiet = TRUE
)
pt <- osrmNearest(apotheke.sf[56, ])
pt$distance
## End(Not run)