ors_matrix | R Documentation |
Obtain one-to-many, many-to-one and many-to-many matrices for time and distance.
ors_matrix(
locations,
profile = ors_profile(),
...,
api_key = ors_api_key(),
output = c("parsed", "text")
)
locations |
List of |
profile |
Route profile, defaults to |
... |
Optional parameters as described here |
api_key |
Character scalar containing openrouteservice API key |
output |
Output format. By default the response is being parsed to a list-based R object |
Duration or distance matrix for multiple source and destination
for "text"
, a character vector of length 1 re-encoded to UTF-8.
for "parsed"
, a parsed R object.
Andrzej Oleś andrzej.oles@gmail.com
coordinates <- list(
c(9.970093, 48.477473),
c(9.207916, 49.153868),
c(37.573242, 55.801281),
c(115.663757,38.106467)
)
# query for duration and distance in km
res <- ors_matrix(coordinates, metrics = c("duration", "distance"), units = "km")
# duration in hours
res$durations / 3600
# distance in km
res$distances
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.