ors_directions {openrouteservice} | R Documentation |
Openrouteservice Directions
Description
Get directions for different modes of transport.
Usage
ors_directions(
coordinates,
profile = ors_profile(),
format = c("geojson", "json", "gpx"),
...,
api_key = ors_api_key(),
output = c("parsed", "text", "sf")
)
Arguments
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 |
Value
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 featuressf
object.
Author(s)
Andrzej OleÅ› andrzej.oles@gmail.com
Examples
# These examples might require interaction to query the local keyring, or
# might fail due to network issues, so they are not run by default
## Not run:
coordinates <- list(c(8.34234, 48.23424), c(8.34423, 48.26424))
# simple call
try( ors_directions(coordinates, preference="fastest") )
# customized options
try( 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))
try( ors_directions(locations, output = "sf") )
## End(Not run)
[Package openrouteservice version 0.6.2 Index]