Learn R Programming

ggmap (version 4.0.0)

trek: Grab a trek from Google

Description

Sequence treks (latitude-longitude sequences following ordinary paths, e.g. roads) between two locations using the Google Directions API. Note: To use Google's Directions API, you must first enable the API in the Google Cloud Platform Console. See register_google().

Usage

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

Value

a tibble

Arguments

from

name of origin addresses in a data frame

to

name of destination addresses in a data frame

mode

driving, bicycling, walking, or transit

output

amount of output ("simple" or "all")

alternatives

should more than one route be provided?

units

"metric"

urlonly

return only the url?

override_limit

override the current query count

ext

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

inject

character string to add to the url

...

...

Author

David Kahle david@kahle.io with the key decoding algorithm due to Stack Overflow user akhmed

See Also