# NOT RUN {
# Authentication
set_auth(
app_id = "<YOUR APP ID>",
app_code = "<YOUR APP CODE>"
)
# Get all from - to combinations from POIs
library(sf)
to <- poi[rep(seq_len(nrow(poi)), nrow(poi)), ]
from <- poi[rep(seq_len(nrow(poi)), each = nrow(poi)),]
idx <- apply(to != from, any, MARGIN = 1)
to <- to[idx, ]
from <- from[idx, ]
# Routing
routes <- route(
start = from, destination = to,
mode = "car", type = "fastest", traffic = TRUE,
vehicle_type = "diesel,5.5",
url_only = TRUE
)
# }
Run the code above in your browser using DataLab