Learn R Programming

stplanr (version 0.1.4)

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)

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.

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 RgoogleMaps::getGeoCode().

See Also

line2route

Examples

Run this code

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

Run the code above in your browser using DataLab