R/osrmfunctions.R
nearest_osm.RdGenerate nearest point on the route network of a point from OSRM locate service
nearest_osm(lat, lng, number = 1, api = 5, profile = "driving", protocol = "v1", osrmurl = "http://router.project-osrm.org", return_sf = FALSE)
| lat | Numeric vector containing latitude coordinate for each coordinate to map. Also accepts dataframe with latitude in the first column and longitude in the second column. |
|---|---|
| lng | Numeric vector containing longitude coordinate for each coordinate to map. |
| number | Number of locations to return (API v5 only) |
| api | An integer value containing the OSRM API version (either 4 or 5). Default is 5. |
| profile | OSRM profile to use (for API v5), defaults to "driving". |
| protocol | The protocol to use for the API (for v5), defaults to "v1". |
| osrmurl | Base URL of the OSRM service |
| return_sf | Boolean value if this function should return an sf object, if FALSE returns sp object (default FALSE). |
Retrieve coordinates of the node(s) on the network mapped from coordinates passed to functions.
# NOT RUN { nearest_osm( lat = 50.3, lng = 13.2 ) # }