Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

route_transportapi_public

Plan a single route with TransportAPI.com


Description

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.

Usage

route_transportapi_public(
  from,
  to,
  silent = FALSE,
  region = "southeast",
  modes = NA,
  not_modes = NA
)

Arguments

from

Text string or coordinates (a numeric vector of length = 2 representing latitude and longitude) representing a point on Earth.

to

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.

silent

Logical (default is FALSE). TRUE hides request sent.

region

String for the active region to use for journey plans. Possible values are 'southeast' (default) or 'tfl'.

modes

Vector of character strings containing modes to use. Default is to use all modes.

not_modes

Vector of character strings containing modes not to use. Not used if modes is set.

Details

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

See Also

line2route

Examples

## Not run: 
# Plan the 'public' route from Hereford to Leeds
rqh <- route_transportapi_public(from = "Hereford", to = "Leeds")
plot(rq_hfd)

## End(Not run)

# Aim plan public transport routes with transportAPI

stplanr

Sustainable Transport Planning

v0.8.2
MIT + file LICENSE
Authors
Robin Lovelace [aut, cre] (<https://orcid.org/0000-0001-5679-6536>), Richard Ellison [aut], Malcolm Morgan [aut] (<https://orcid.org/0000-0002-9488-9183>), Barry Rowlingson [ctb], Nick Bearman [ctb], Nikolai Berkoff [ctb], Scott Chamberlain [rev] (Scott reviewed the package for rOpenSci, see https://github.com/ropensci/onboarding/issues/10), Mark Padgham [ctb], Andrea Gilardi [ctb] (<https://orcid.org/0000-0002-9424-7439>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.