Description Usage Arguments Details Value Author(s)
This function gets the distance matrix between two geocodes
1 | get_distance(from_lat, from_lng, to_lat, to_lng)
|
from_lat |
is the starting latitude |
from_lng |
is the starting longitude |
to_lat |
is the ending latitude |
to_lng |
is the ending longitude |
The function calls the distance matrix API from Google which returns a JSON containing the destination address, the origin address, the distance in miles (character), distance in meters (numeric), the duration in hours and minutes(character), the distance in minutes(numeric), and the call STATUS. Can be used the same way as the 'mapdist' function in ggmap, but works better with geocodes since it does not require a reverse geocode which often times fails.
data frame that contains the distance matrix data from Google's API
Martin Boros
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.