Google_drivetime: Get drive time in hours from Google.com Routing API

Description Usage Arguments Value

View source: R/Google_drivetime.R

Description

Google_drivetime is designed to take degree or radian geocoordinates or location names, user app credentials , and some other API inputs (set to defaults). The function queries the Google Directions API ( https://developers.google.com/maps/documentation/directions/ intro#DirectionsRequests) and return the drive time from the JSON output code. This drive time portion of the JSON is originally return in minutes. This function is designed to take an argument for the user preferred time (seconds, minutes, or hours).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
Google_drivetime(
  origin = NULL,
  destination = NULL,
  key = NULL,
  mode = "driving",
  transit_mode = NULL,
  transit_routing_preference = NULL,
  time_format = "minutes",
  distance_format = "customary",
  coordinate_type = "deg",
  verbose = FALSE
)

Arguments

origin

a string or vector of two numerics; if a location string, this should be an address, if a vector of length two numerics this should be the latitude and longitude coordinates for the origin location

destination

a string or vector of two numerics; if a location string, this should be an address, if a vector of length two numerics this should be the latitude and longitude coordinates for the destination location

key

a string; the user's App Code for the Google.com JavaScript/REST (requires registration)

mode

a string; a transportation method for the route:

  1. "driving"

  2. "walking"

  3. "bicycling"

  4. "transit"

transit_mode

a string; sub-type for "transit" otherwise should be NULL:

  1. "bus": the calculated route should prefer travel by bus

  2. "subway": the calculated route should prefer travel by subway

  3. "train": the calculated route should prefer travel by train

  4. "tram": the calculated route should prefer travel by tram and light rail

  5. "rail": the calculated route should prefer travel by train, tram, light rail, and subway

transit_routing_preference

a string; specifies preferences for the "transit", otherwise should be NULL:

  1. "less_walking"

  2. "fewer_transfers"

time_format

a string; the preferred time format for results:

  1. "hours"

  2. "minutes"

  3. "seconds"

distance_format

a string; the pregerred format for measuring distance:

  1. "customary"

  2. "metric"

coordinate_type

a string; if using geocoordinates, whether they are in degrees or radians:

  1. "rad" (radians)

  2. "deg" (degrees)

verbose

a boolean; TRUE to display json webaddress, FALSE to not display json webaddress

Value

the travel time and distance as specified between two locations


wolfm4ne/gcd documentation built on Oct. 18, 2020, 10:38 p.m.