Learn R Programming

ggmap (version 4.0.0)

route: Grab a route from Google

Description

Route two locations: determine a sequence of steps (legs) 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

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

routeQueryCheck()

Value

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

Arguments

from

vector of origin addresses

to

vector of destination addresses

mode

driving, bicycling, walking, or transit

structure

structure of output, "legs" or "route", see examples

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

See Also

https://developers.google.com/maps/documentation/directions/, trek(), legs2route(), geom_leg(), register_google()