View source: R/otp_get_distance.R
otp_get_distance | R Documentation |
Finds the distance in metres between supplied origin and destination. Only makes sense for walk, cycle or car modes (not transit)
otp_get_distance(otpcon, fromPlace, toPlace, mode = "CAR")
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. |
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.