powered by
This function interfaces with the nearest OSRM service.
osrmNearest( loc, exclude, osrm.server = getOption("osrm.server"), osrm.profile = getOption("osrm.profile") )
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.
a point to snap to the street network. loc can be:
loc
a vector of coordinates (longitude and latitude, WGS 84),
a data.frame of longitudes and latitudes (WGS 84),
a matrix of longitudes and latitudes (WGS 84),
an sfc object of type POINT,
an sf object of type POINT.
If src is a data.frame, a matrix, an sfc object or an sf object then only the first row or element is considered.
src
pass an optional "exclude" request option to the OSRM API.
the base URL of the routing server.
the routing profile to use, e.g. "car", "bike" or "foot".
if (FALSE) { library(sf) apotheke.sf <- st_read(system.file("gpkg/apotheke.gpkg", package = "osrm"), quiet = TRUE ) pt <- osrmNearest(apotheke.sf[56, ]) pt$distance }
Run the code above in your browser using DataLab