viaroute_api_v5: travel time or full information of a route for OSRM API 5

Description Usage Arguments Value Examples

View source: R/viaroute.R

Description

For a given start- and end-destination, viaroute() calculates route informations using OSRM API 5. 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

1
viaroute_api_v5(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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
# example with onlinehost
osrmr:::viaroute_api_v5(47, 9, 48, 10 , FALSE, osrmr:::server_address(FALSE))

# example with localhost
Sys.setenv("OSRM_PATH"="C:/OSRM_API5")
osrmr::run_server("switzerland-latest.osrm")
osrmr:::viaroute_api_v5(47, 9, 48, 10 , FALSE, osrmr:::server_address(TRUE))
osrmr::quit_server()
Sys.unsetenv("OSRM_PATH")
## End(Not run)

osrmr documentation built on May 31, 2021, 5:07 p.m.