otp_get_distance {otpr} | R Documentation |
Finds the distance in metres between supplied origin and destination
Description
Finds the distance in metres between supplied origin and destination. Only makes sense for walk, cycle or car modes (not transit)
Usage
otp_get_distance(otpcon, fromPlace, toPlace, mode = "CAR")
Arguments
otpcon |
An OTP connection object produced by |
fromPlace |
Numeric vector, Latitude/Longitude pair, e.g. 'c(53.48805, -2.24258)' |
toPlace |
Numeric vector, Latitude/Longitude pair, e.g. 'c(53.36484, -2.27108)' |
mode |
Character vector, single mode of travel. Valid values are WALK, BICYCLE, or CAR. Default is CAR. |
Value
If OTP has not returned an error then a list containing errorId
with the value "OK", and the distance
in metres. If OTP has returned an
error then a list containing errorId
with the OTP error code and errorMessage
with the error message returned by OTP. In both cases there will be a third element
named query
which is a character string containing the URL that was submitted to the OTP API.
Examples
## Not run:
otp_get_distance(otpcon, fromPlace = c(53.48805, -2.24258), toPlace = c(53.36484, -2.27108))
otp_get_distance(otpcon, fromPlace = c(53.48805, -2.24258), toPlace = c(53.36484, -2.27108),
mode = "WALK")
## End(Not run)