get_distance: Getting drive distance using Google Distance Matrix API

Description Usage Arguments Details Value Author(s)

View source: R/drivetime.R

Description

This function gets the distance matrix between two geocodes

Usage

1
get_distance(from_lat, from_lng, to_lat, to_lng)

Arguments

from_lat

is the starting latitude

from_lng

is the starting longitude

to_lat

is the ending latitude

to_lng

is the ending longitude

Details

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.

Value

data frame that contains the distance matrix data from Google's API

Author(s)

Martin Boros


mboros1/drivetime documentation built on May 25, 2019, 9:34 p.m.