Description Usage Arguments Value Examples
nearest() calculates the nearest position to the given coordinates which can be accessed by car. The coordinate-standard is WGS84. Attention: The OSRM API v4 is only working locally, but not with the 'OSRM' webserver.
1 | nearest(lat, lng, api_version = 5, localhost = F, timeout = 0.001)
|
lat, |
A numeric (-90 < lat < 90) |
lng, |
A numeric (-180 < lng < 180) |
api_version, |
A numeric (either 4 or 5) |
localhost, |
A logical (TRUE = localhost is used, FALSE = onlinehost is used) |
timeout |
A numeric indicating the timeout between server requests (in order to prevent queue overflows). Default is 0.001s. |
A data.frame with lat and lng
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
osrmr::nearest(47,9, 5, FALSE)
Sys.setenv("OSRM_PATH_API_5"="C:/OSRM_API5")
osrmr::run_server(Sys.getenv("OSRM_PATH_API_5"), "switzerland-latest.osrm")
osrmr::nearest(47,9, 5, TRUE)
osrmr::quit_server()
Sys.unsetenv("OSRM_PATH_API_5")
Sys.setenv("OSRM_PATH_API_4"="C:/OSRM_API4")
osrmr::run_server(Sys.getenv("OSRM_PATH_API_4"), "switzerland-latest.osrm")
osrmr::nearest(47,9, 4, TRUE)
osrmr::quit_server()
Sys.unsetenv("OSRM_PATH_API_4")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.