GoogleRoadDist: Road Distance between two points from Google Maps

Description Usage Arguments Value Author(s) References Examples

Description

Returns the road distance and time from Google Maps between two points in space, origin and destination.

Usage

1
  GoogleRoadDist(orilat,orilon,deslat,deslon,mode,apikey,departure_time,arrival_time,transit_mode,transit_routing_preference)

Arguments

orilat

Latitude coordinate of the origin point in geodesic format. This could be numeric or string.

orilon

Longitude coordinate of the origin point in geodesic format. This could be numeric or string.

deslat

Latitude coordinate of the destination point in geodesic format. This could be numeric or string.

deslon

Longitude coordinate of the destination point in geodesic format. This could be numeric or string.

mode

Travel mode in string format as Google requires it. Possible alternatives are:

  • driving (default): indicates distance calculation using the road network.

  • walking: requests distance calculation for walking via pedestrian paths & sidewalks (where available).

  • bicycling: requests distance calculation for bicycling via bicycle paths & preferred streets (where available).

  • transit: requests distance calculation via public transit routes (where available). This value may only be specified if the request includes an API key or a Google Maps API for Work client ID. If you set the mode to transit you can optionally specify either a departure_time or an arrival_time. If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time). You can also optionally include a transit_mode and/or a transit_routing_preference.

apikey

Your API Key from https://developers.google.com/places/web-service

Value

A list with two numeric elements containing distance in miles and minutes of a trip between two points.

Author(s)

Esteban Lopez <lopezoch@illinois.edu>

References

See the full documentation at https://developers.google.com/maps/documentation/distance-matrix/

Examples

1
2
3
4
5
  orilat<-40.110796
  orilon<--88.206985
  deslat<-40.109909
  deslon<--88.227235
  mysearch<-GoogleRoadDist(orilat,orilon,deslat,deslon)

estebanlp/GoogleDataSearch documentation built on May 16, 2019, 8:52 a.m.