The function returns a SpatialLinesDataFrame object.
See https://github.com/graphhopper for more information.To test graphopper is working for you, try something like this, but with
your own API key:
To use this function you will need to obtain an API key from
https://graphhopper.com/#directions-api.
It is assumed that you have set your api key as a system environment
for security reasons (so you avoid typing the API key in your code).
Do this by adding the following to your .Renviron file (see ?.Renviron
or https://cran.r-project.org/web/packages/httr/vignettes/api-packages.html
for more on this):
GRAPHHOPPER='FALSE-Key-eccbf612-214e-437d-8b73-06bdf9e6877d'
.
(Note: key not real, use your own key.)
obj <- jsonlite::fromJSON(url)
Where url
is an example api request from
https://github.com/graphhopper/directions-api/blob/master/routing.md.