Description Usage Arguments Examples
Calculate route between series of points
1 | calculate_route(locations, alternatives = 0)
|
locations |
A |
alternatives |
Number of alternative routes. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library(dplyr)
library(sf)
library(tomtom)
TOMTOM_API_KEY = Sys.getenv("TOMTOM_API_KEY")
set_api_key(TOMTOM_API_KEY)
locations <- tribble(
~label, ~lon, ~lat,
"Durban", 31.05, -29.88,
"Port Elizabeth", 25.6, -33.96,
"Cape Town", 18.42, -33.93,
"Johannesburg", 28.05, -26.20
)
locations <- st_as_sf(locations, coords = c("lon", "lat"), remove = FALSE, crs = 4326)
calculate_route(locations)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.