Learn R Programming

hereR (version 0.2.1)

route_matrix: HERE Routing API: Route Matrix

Description

Calculates a matrix of route summaries between given points of interest (POIs). Various transport modes and traffic information at a provided timestamp are supported. The requested matrix is split into (sub-)matrices of dimension 15x100 to use the maximum matrix size per request and thereby minimize the number of overall needed requests. The result is one route summary matrix, that fits the order of the provided POIs: startIndex, destinationIndex.

Usage

route_matrix(start, destination = start, type = "fastest",
  mode = "car", traffic = FALSE, searchRange = 99999999,
  attribute = c("distance", "traveltime"), departure = NULL,
  url_only = FALSE)

Arguments

start

sf object, Points of Interest (POIs) of geometry type POINT for the start locations.

destination

sf object, Points of Interest (POIs) of geometry type POINT for the destination locations.

type

character, set the routing type: "fastest", "shortest" or "balanced".

mode

character, set the transport mode: "car", "pedestrian", "carHOV" or "truck".

traffic

boolean, use real-time traffic or prediction in routing (default = FALSE)? If no departure date and time is set, the current timestamp at the moment of the request is used for departure.

searchRange

numeric, value in meters to limit the search radius in the route generation (default = 99999999).

attribute

character, attributes to be calculated on the routes: "distance" or "traveltime" (default = c("distance", "traveltime").

departure

datetime, timestamp of type POSIXct, POSIXt for the departure.

url_only

boolean, only return the generated URLs (default = FALSE)?

Value

A data.table containing the requested route matrix data.

References

HERE Routing API: Calculate Matrix

Examples

Run this code
# NOT RUN {
# Authentication
set_auth(
  app_id = "<YOUR APP ID>",
  app_code = "<YOUR APP CODE>"
)

# Create routes summaries between all POIs
mat <- route_matrix(
  start = poi,
  departure = as.POSIXct("2019-10-10 15:45:00"),
  traffic = TRUE,
  url_only = TRUE
)
# }

Run the code above in your browser using DataLab