otp_plan: Get the geometry of a route from OTP

Description Usage Arguments Details

View source: R/otp-route.R

Description

Get the geometry of a route from OTP

Usage

1
2
3
4
otp_plan(otpcon = NA, fromPlace = NA, toPlace = NA, mode = "CAR",
  date_time = Sys.time(), arriveBy = FALSE, maxWalkDistance = 800,
  walkReluctance = 2, transferPenalty = 0, minTransferTime = 0,
  full_elevation = FALSE)

Arguments

otpcon

OTP connection object produced by otp_connect()

fromPlace

Numeric vector, Latitude/Longitude pair, e.g. 'c(51.529258,-0.134649)'

toPlace

Numeric vector, Latitude/Longitude pair, e.g. 'c(51.506383,-0.088780,)'

mode

Character vector of modes of travel valid values TRANSIT, WALK, BICYCLE, CAR, BUS, RAIL, default CAR

date_time

POSIXct, a date and time, defaults to current date and time

arriveBy

Logical, Whether the trip should depart or arrive at the specified date and time, default FALSE

maxWalkDistance

Numeric passed to OTP

walkReluctance

Numeric passed to OTP

transferPenalty

Numeric passed to OTP

minTransferTime

Numeric passed to OTP

full_elevation

Logical, should the full elevation profile be returned, default FALSE

Details

This function returns a SF data.frame with one row for each leg of the journey (a leg is defined by a change in mode). For transit more than one route option may be returned and is indicated by the route_option column.

Elevation OTP supports elevation data, and can return the elevation profile of the route if available. OTP returns the elevation profile separately from the XY coordinates, this means there is not direct match between the number of XY points and the number of Z points. OTP also only returns the elevation profile for the first leg of the route (this appears to be a bug). As default the otp_plan function matches the elevation profile to the XY coordinates to return a SF linestring with XYZ coordinates. If you require a more detailed elevation profile, the full_elevation parameter will return a nested data.frame with three columns. first and second are returned from OTP, while distance is the cumulative distance along the route and is derived from First.


marcusyoung/opentripplanner documentation built on May 20, 2019, 4:42 p.m.