
Last chance! 50% off unlimited learning
Sale ends in
Calculates a matrix of route summaries between given points of interest (POIs) using the HERE 'Routing' API.
Various transport modes and traffic information at a provided timestamp are supported.
The requested matrix is split into (sub-)matrices of dimension 15x100 to use the
maximum matrix size per request and thereby minimize the number of overall needed requests.
The result is one route summary matrix, that fits the order of the provided POIs: origIndex
, destIndex
.
route_matrix(
origin,
destination = origin,
datetime = Sys.time(),
type = "fastest",
mode = "car",
traffic = FALSE,
search_range = 99999999,
attribute = c("distance", "traveltime"),
url_only = FALSE
)
sf
object, the origin locations of geometry type POINT
.
sf
object, the destination locations of geometry type POINT
.
POSIXct
object, datetime for the departure.
character, set the routing type: "fastest"
, "shortest"
or "balanced"
.
character, set the transport mode: "car"
, "pedestrian"
, "carHOV"
or "truck"
.
boolean, use real-time traffic or prediction in routing (default = FALSE
)? If no datetime
is set, the current timestamp at the moment of the request is used for datetime
.
numeric, value in meters to limit the search radius in the route generation (default = 99999999
).
character, attributes to be calculated on the routes: "distance"
or "traveltime"
(default = c("distance", "traveltime")
.
boolean, only return the generated URLs (default = FALSE
)?
A data.frame
containing the requested route matrix data.
# NOT RUN {
# Provide an API Key for a HERE project
set_key("<YOUR API KEY>")
# Create routes summaries between all POIs
mat <- route_matrix(
origin = poi,
traffic = TRUE,
url_only = TRUE
)
# }
Run the code above in your browser using DataLab