Learn R Programming

stplanr (version 0.4.0)

locate2spdf: Return SpatialPointsDataFrame with located points from OSRM locate service

Description

Return SpatialPointsDataFrame with located points from OSRM locate service

Usage

locate2spdf(lat, lng = lng, osrmurl = "http://router.project-osrm.org",
  return_sf = FALSE)

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.

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).

Details

Retrieve coordinates of the node(s) on the network mapped from coordinates passed to functions using OSRM API v4 only. For API v5, use nearest_osm.

See Also

Other nodes: geo_code, nearest_google, nearest_osm

Examples

Run this code
# NOT RUN {
locate2spdf(
  lat = c(50.3, 50.2),
  lng = c(13.2, 13.1)
)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab