ors_directions | R Documentation |
Get directions for different modes of transport.
ors_directions(
coordinates,
profile = ors_profile(),
format = c("geojson", "json", "gpx"),
...,
api_key = ors_api_key(),
output = c("parsed", "text", "sf")
)
coordinates |
List of |
profile |
Route profile, defaults to |
format |
Response format, 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 |
Route between two or more locations in the selected format
structured according to output
:
for "text"
, a character vector of length 1 re-encoded to UTF-8.
for "parsed"
, a parsed R object.
for "sf"
, a simple features sf
object.
Andrzej Oleś andrzej.oles@gmail.com
coordinates <- list(c(8.34234, 48.23424), c(8.34423, 48.26424))
# simple call
ors_directions(coordinates, preference="fastest")
# customized options
ors_directions(coordinates, profile="cycling-mountain", elevation=TRUE)
# list of locations as `data.frame` output as simple features `sf` object
locations <- data.frame(lng = c(8.34234, 8.327807, 8.34423),
lat = c(48.23424, 48.239368, 48.26424))
ors_directions(locations, output = "sf")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.