Learn R Programming

ggmap (version 4.0.0)

mapdist: Compute map distances using Google

Description

Compute map distances using Google's Distance Matrix API. Note: To use Google's Distance Matrix API, you must first enable the API in the Google Cloud Platform Console. See register_google().

Usage

mapdist(
  from,
  to,
  mode = c("driving", "walking", "bicycling", "transit"),
  output = c("simple", "all"),
  urlonly = FALSE,
  override_limit = FALSE,
  ext = "com",
  inject = "",
  ...
)

distQueryCheck()

Value

a data frame (output="simple") or all of the geocoded information (output="all")

Arguments

from

name of origin addresses in a data frame (vector accepted), or a data frame with from and to columns

to

name of destination addresses in a data frame (vector accepted)

mode

driving, bicycling, walking, or transit

output

amount of output

urlonly

return only the url?

override_limit

override the current query count (.google_distance_query_times)

ext

top level domain domain extension (e.g. "com", "co.nz")

inject

character string to add to the url

...

...

Author

David Kahle david@kahle.io

Details

if parameters from and to are specified as geographic coordinates, they are reverse geocoded with revgeocode. note that the google maps api limits to 2500 element queries a day.

See Also