hereR
R interface to the HERE REST APIs: (1) geocode and autocomplete addresses or reverse geocode POIs using the Geocoder API; (2) routing directions, travel distance or time matrices and isolines using the Routing API; (3) real-time traffic flow and incident information from the Traffic API; (4) weather forecasts, reports on current weather conditions and astronomical information at a specific location from the Destination Weather API.
Locations, routes and isolines are returned as sf
objects and tables as data.table
objects.
Installation
You can install the released version of hereR
from CRAN with:
install.packages("hereR")
... or install the development version from GitHub with:
devtools::install_github("munterfinger/hereR")
Application credentials
In order to use the functionality of the hereR
package, application credentials (APP ID and APP CODE) for a HERE project of type REST & XYZ HUB API/CLI have to be provided. These credentials will be set for the current R session and will be used to authenticate in the reqeusts to the HERE REST APIs.
To set the credentials, please use:
library(hereR)
set_auth(
app_id = "<YOUR APP ID>",
app_code = "<YOUR APP CODE>"
)
No login yet? Get your free login here: developer.here.com
Examples
- Geocode addresses:
locs <- geocode(addresses = c("Schweighofstrasse 190, Zürich, Schweiz", "Hardstrasse 48, Zürich, Schweiz"))
- Autocomplete addresses:
suggestions <- autocomplete(addresses = c("Schweighofstrasse", "Hardstrasse"))
- Reverse geocode POIs:
addresses <- reverse_geocode(poi = locs)
- Construct a route between points:
routes <- route(start = locs_start, destination = locs_dest, mode = "car")
- Create a route matrix between points:
route_matrix <- route_matrix(start = locs, mode = "car")
- Request weather observations at specific locations:
observations <- weather(poi = locs, product = "observation")
- Request weather forecast at specific locations:
forecast <- weather(poi = locs, product = "forecast_hourly")
- Request astronomical information at specific locations:
astronomy <- weather(poi = locs, product = "forecast_astronomy")
- Request weather alerts at specific locations:
alerts <- weather(poi = locs, product = "alerts")
- Get real-time traffic flow in a specific area:
flow <- traffic(aoi = area, product = "flow")
- Get traffic incidents in a specific area:
incidents <- traffic(aoi = area, product = "incidents")