Provides an R interface to the TransportAPI.com public transport API. The function returns a SpatialLinesDataFrame object representing the public route. Currently only works for the United Kingdom. See https://developer.transportapi.com/documentationfor more information.
route_transportapi_public(from, to, silent = FALSE,
region = "southeast", modes = NA, not_modes = NA)
Text string or coordinates (a numeric vector of
length = 2
representing latitude and longitude) representing a point
on Earth.
Text string or coordinates (a numeric vector of
length = 2
representing latitude and longitude) representing a point
on Earth. This represents the destination of the trip.
Logical (default is FALSE). TRUE hides request sent.
String for the active region to use for journey plans. Possible values are 'southeast' (default) or 'tfl'.
Vector of character strings containing modes to use. Default is to use all modes.
Vector of character strings containing modes not to use.
Not used if modes
is set.
This function uses the online routing service TransportAPI.com to find public routes between origins and destinations. It does not require any key to access the API.
Note that if from
and to
are supplied as
character strings (instead of lon/lat pairs), Google's
geo-coding services are used via geo_code
.
Note: there is now a dedicated transportAPI package: https://github.com/ITSLeeds/transportAPI
line2route
Other routes: line2routeRetry
,
line2route
, nearest2spdf
,
route_cyclestreet
,
route_dodgr
,
route_graphhopper
,
route_local
, route_osrm
,
route
, viaroute2sldf
,
viaroute
# NOT RUN {
# }
# NOT RUN {
# Plan the 'public' route from Hereford to Leeds
rqh <- route_transportapi_public(from = "Hereford", to = "Leeds")
plot(rq_hfd)
# }
# NOT RUN {
# Aim plan public transport routes with transportAPI
# }
Run the code above in your browser using DataLab