osrmNearest | R Documentation |
This function interfaces with the nearest OSRM
service.
osrmNearest(
loc,
exclude,
osrm.server = getOption("osrm.server"),
osrm.profile = getOption("osrm.profile")
)
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". |
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.