viaroute_api_v4 {osrmr} | R Documentation |
travel time or full information of a route for OSRM API 4
Description
For a given start- and end-destination, viaroute() calculates route informations using OSRM API 4. OSRM chooses the nearest point which can be accessed by car for the start and destination. The coordinate-standard is WGS84. Attention: The OSRM API-4 is only working locally, but not with the onlinehost.
Usage
viaroute_api_v4(lat1, lng1, lat2, lng2, instructions, address)
Arguments
lat1 |
A numeric (-90 < lat1 < 90) -> start-destination |
lng1 |
A numeric (-180 < lng1 < 180) -> start-destination |
lat2 |
A numeric (-90 < lat2 < 90) -> end-destination |
lng2 |
A numeric (-180 < lng2 < 180) -> end-destination |
instructions |
A logical. If FALSE, only the traveltime (in seconds, as numeric) will be returned. If TRUE, more details of the route are returned (as list). |
address |
A character specifying the serveraddress (local or online) |
Value
a numeric or a list (depending on parameter instructions)
Examples
## Not run:
Sys.setenv("OSRM_PATH"="C:/OSRM_API4")
osrmr::run_server("switzerland-latest.osrm")
osrmr:::viaroute_api_v4(47,9,48,10, FALSE, osrmr:::server_address(TRUE))
osrmr::quit_server()
Sys.unsetenv("OSRM_PATH")
## End(Not run)