Description Usage Arguments Value Examples
View source: R/otp_get_isochrone.R
Returns one or more travel time isochrones in either GeoJSON format or as an sf object. Only works correctly for walk and/or transit modes - a limitation of OTP. Isochrones can be generated either from a location or to a location.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | otp_get_isochrone(
otpcon,
location,
fromLocation = TRUE,
format = "JSON",
mode = "TRANSIT",
date = format(Sys.Date(), "%m-%d-%Y"),
time = format(Sys.time(), "%H:%M:%S"),
cutoffs,
batch = TRUE,
arriveBy = FALSE,
maxWalkDistance = NULL,
walkReluctance = 2,
waitReluctance = 1,
transferPenalty = 0,
minTransferTime = 0,
extra.params = list()
)
|
otpcon |
An OTP connection object produced by |
location |
Numeric vector, Latitude/Longitude pair, e.g. 'c(53.48805, -2.24258)' |
fromLocation |
Logical. If TRUE (default) the isochrone
will be generated from the |
format |
Character, required format of returned isochrone(s). Either JSON (returns GeoJSON) or SF (returns simple feature collection). Default is JSON. |
mode |
Character vector, mode(s) of travel. Valid values are: WALK, TRANSIT, BUS, RAIL, TRAM, SUBWAY. TRANSIT will use all available transit modes. Default is TRANSIT. WALK mode is automatically added to TRANSIT, BUS, RAIL, TRAM, and SUBWAY. Due to an OTP limitation this function is not suitable for CAR or BICYCLE modes. |
date |
Character, must be in the format mm-dd-yyyy. This is the desired date of travel. Only relevant for transit modes. Default is the current system date. |
time |
Character, must be in the format hh:mm:ss.
If |
cutoffs |
Numeric vector, containing the cutoff times in seconds. for example: 'c(900, 1800, 2700)' would request 15, 30 and 60 minute isochrones. Can be a single value. |
batch |
Logical. If true, goal direction is turned off and a full path tree is built |
arriveBy |
Logical. Whether a trip should depart (FALSE) or arrive (TRUE) at the specified date and time. Default is FALSE. |
maxWalkDistance |
Numeric. The maximum distance (in meters) that the user is willing to walk. Default is NULL (the parameter is not passed to the API and the OTP default of unlimited takes effect). This is a soft limit in OTPv1 and is ignored if the mode is WALK only. In OTPv2 this parameter imposes a hard limit on WALK, CAR and BICYCLE modes (see: http://docs.opentripplanner.org/en/latest/OTP2-MigrationGuide/#router-config). |
walkReluctance |
A single numeric value. A multiplier for how bad walking is compared to being in transit for equal lengths of time. Default = 2. |
waitReluctance |
A single numeric value. A multiplier for how bad waiting for a
transit vehicle is compared to being on a transit vehicle. This should be greater
than 1 and less than |
transferPenalty |
Integer. An additional penalty added to boardings after the first. The value is in OTP's internal weight units, which are roughly equivalent to seconds. Set this to a high value to discourage transfers. Default is 0. |
minTransferTime |
Integer. The minimum time, in seconds, between successive trips on different vehicles. This is designed to allow for imperfect schedule adherence. This is a minimum; transfers over longer distances might use a longer time. Default is 0. |
extra.params |
A list of any other parameters accepted by the OTP API LIsochrone entry point. For
advanced users. Be aware that otpr will carry out no validation of these additional
parameters. They will be passed directly to the API. Do not pass 'fromPlace' or 'toPlace'
to this function. These parameters are handled internally based on the values of |
Returns a list. First element in the list is errorId
. This is "OK" if
OTP successfully returned the isochrone(s), otherwise it is "ERROR". The second
element of list varies:
If errorId
is "ERROR" then response
contains the OTP error message.
If errorId
is "OK" then response
contains the the isochrone(s) in
either GeoJSON format or as an sf object, depending on the value of the
format
argument.
The third element of the list is query
which is a character string containing the URL
that was submitted to the OTP API.
1 2 3 4 5 6 7 | ## Not run:
otp_get_isochrone(otpcon, location = c(53.48805, -2.24258), cutoffs = c(900, 1800, 2700))
otp_get_isochrone(otpcon, location = c(53.48805, -2.24258), fromLocation = FALSE,
cutoffs = c(900, 1800, 2700), mode = "BUS")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.