Learn R Programming

stplanr (version 0.1.4)

nearest_osm: Generate nearest point on the route network of a point from OSRM locate service

Description

Generate nearest point on the route network of a point from OSRM locate service

Usage

nearest_osm(lat, lng, number = 1, api = 5, profile = "driving", protocol = "v1", osrmurl = "http://router.project-osrm.org")

Arguments

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

Details

Retrieve coordinates of the node(s) on the network mapped from coordinates passed to functions.

Examples

Run this code
## Not run: 
#  nearest_osm(
#    lat = 50.3,
#    lng = 13.2
#  )
# ## End(Not run)

Run the code above in your browser using DataLab