get_distances: Use the Google Distance Matrix API

Description Usage Arguments Details

View source: R/get_distances.R

Description

The Distance Matrix API is a service that provides travel distance and time for a matrix of origins and destinations. The API returns information based on the recommended route between start and end points, as calculated by the Google Maps API, and consists of rows containing duration and distance values for each pair.

Usage

1
2
3
4
5
6
7
get_distances(
  origins,
  destinations,
  departure_time = "now",
  .api_key,
  .output_format = "json"
)

Arguments

origins

character vector. Origin addresses. These are compared to every value in destinations.

destinations

character vector. Destination addresses. These are compared to every value in origins

departure_time

a datetime (POSIXct) or 'now'. The desired time of departure.

.api_key

google cloud API key. This must be setup and enabled to use the Google distance matrix API.

.output_format

character. The return format from the API call. Either 'json' or 'xml'

Details

https://maps.googleapis.com/maps/api/distancematrix/outputFormat?parameters


Shaunson26/gdistanceR documentation built on Feb. 28, 2022, 12:45 a.m.