The hereR package provides an interface to the HERE REST APIs for R: (1) geocode and autosuggest addresses or reverse geocode POIs using the Geocoder API; (2) route directions, travel distance or time matrices and isolines using the Routing API, Matrix Routing API and Isoline Routing API; (3) request real-time traffic flow and incident information from the Traffic API; (4) find public transport connections and nearby stations using the Public Transit API; (5) request intermodal routes using the Intermodal Routing API; (6) get 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
You can install the released version of hereR from CRAN with:
Install the development version from GitHub with:
This package requires an API key for a HERE project. The key is set for the current R session and is used to authenticate in the requests to the APIs. A login can be created on developer.here.com. In order to obtain the API key navigate to a project of your choice in the developer portal, select ‘REST: Generate APP’ and then ‘Create API Key’.
To set the API key, use:
Note: Your use of the HERE APIs with this package is subject to the HERE Developer Terms and Conditions. For freemium licenses the number of requests per second (RPS) is limited, use
set_freemium(FALSE) to turn off limits for accounts with paid plans.
Once valid application credentials are created and the key is set in the R session, the APIs can be addressed using the functions shown in the examples below. A more detailed description can be found in the documentation of the functions and the package vignettes.
Geocoding & Search API: Autosuggest and geocode addresses or reverse geocode POIs.
geocode(c("Schweighofstrasse 190, Zurich, Switzerland", "Hardstrasse 48, Zurich, Switzerland")) autosuggest(c("Schweighofstrasse", "Hardstrasse")) reverse_geocode(poi)
Routing API: Construct route geometries with elevation (dim =
Matrix Routing API: Request a matrix of route summaries.
route_matrix(poi, transport_mode = "car", traffic = TRUE) route_matrix( geocode(c("Schweighofstrasse 190, Zurich, Switzerland", "Hardstrasse 48, Zurich, Switzerland")), transport_mode = "bicycle", traffic = FALSE )
Isoline Routing API: Construct isolines around points (time, distance or consumption).
Traffic API: Get real-time traffic flow or incidents in a specific area.
Public Transit API: Request public transport connections between points or find stations nearby.
Intermodal Routing API: Get routes with various combinations of transport modes.
intermodal_route(poi[1:2, ], poi[3:4, ])
Destination Weather API: Request weather observations, forecasts, astronomical information or alerts at specific locations.