Route public transport connections with geometries (LINESTRING
) between pairs of points using the HERE 'Public Transit' API.
Two modes are provided:
summary = FALSE
: The public transport connections are returned as mulitple sections with the same vehicle and transport mode. Each section has a detailed route geometry.
summary = TRUE
: A summary of the connections is retrieved, where each connection is represented as one row with a unified and simplified geometry.
connection(
origin,
destination,
datetime = Sys.time(),
arrival = FALSE,
results = 3,
transfers = -1,
transport_mode = NULL,
summary = FALSE,
url_only = FALSE
)
sf
object, the origin locations of geometry type POINT
.
sf
object, the destination locations of geometry type POINT
.
POSIXct
object, datetime for the departure (or arrival if arrival = TRUE
).
boolean, calculate connections for arrival at the defined time (default = FALSE
)?
numeric, maximum number of suggested public transport routes (Valid range: 1 and 6).
numeric, maximum number of transfers allowed per route (Valid range: -1 and 6, whereby the default = -1
allows for unlimited transfers).
character, enable or disable ("-"
prefix) transport modes. Note: Do not enable and disable modes at the same time (default = NULL
).
boolean, return a summary of the public transport connections instead of the sections of the routes (default = FALSE
)?
boolean, only return the generated URLs (default = FALSE
)?
An sf
object containing the requested routes.
# Provide an API Key for a HERE project
set_key("<YOUR API KEY>")
# Connection sections
sections <- connection(
origin = poi[3:4, ], destination = poi[5:6, ],
summary = FALSE, url_only = TRUE
)
# Connection summary
summary <- connection(
origin = poi[3:4, ], destination = poi[5:6, ],
summary = TRUE, url_only = TRUE
)