google_map_directions: Google Map Directions

Description Usage Arguments Note Examples

View source: R/google_map_urls.R

Description

Opens Google Maps in a browser with the resutls of the specified directions query

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
google_map_directions(
  origin = NULL,
  origin_place_id = NULL,
  destination = NULL,
  destination_place_id = NULL,
  travel_mode = NULL,
  dir_action = NULL,
  waypoints = NULL,
  waypoint_place_ids = NULL
)

Arguments

origin

string of an address or search term, or vector of lat/lon coordinates

origin_place_id

a Google place id (https://developers.google.com/places/web-service/place-id). If used, you must also specify an origin

destination

string of an address or vector of lat/lon coordinates

destination_place_id

a Google place id (https://developers.google.com/places/web-service/place-id). If used, you must also specify an destination

travel_mode

one of driving, walking, bicycling or transit. If not supplied, the Google Map will show one or more of the most relevant modes for the route.

dir_action

can only be "navigate". If set, the map will attempt to launch turn-by-turn navigation or route preview to the destination.

waypoints

List of either place names, addresses, or vectors of lat/lon coordinates. Up to 3 are allowed on mobile devices, and up to 9 otherwise.

waypoint_place_ids

vector of place_ids to match against the list of waypoints. If used, the waypoints must also be used.

Note

There is no need for an api key

Waypoints are not supported on all Google Map products. In those cases, this parameter will be ignored.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
## Not run: 

google_map_directions(origin = "Google Pyrmont NSW",
  destination = "QVB, Sydney", destination_place_id = "ChIJISz8NjyuEmsRFTQ9Iw7Ear8",
  travel_mode = "walking")


google_map_directions(origin = "Melbourne Cricket Ground",
  destination = "Flinders Street Station",
  dir_action = "navigate")

google_map_directions(origin = "Melbourne Cricket Ground",
  destination = "Flinders Street Station",
  travel_mode = "walking",
  waypoints = list("National Gallery of Victoria", c(-37.820860, 144.961894)))


google_map_directions(origin = "Paris, France",
  destination = "Cherbourg, France",
  travel_mode = "driving",
  waypoints = list("Versailles, France", "Chartres, France", "Le Mans, France",
    "Caen, France"))


google_map_directions(origin = "Paris, France",
  destination = "Cherbourg, France",
  travel_mode = "driving",
  waypoints = list("Versailles, France", "Chartres, France", "Le Mans, France",
    "Caen, France"),
  waypoint_place_ids = list("ChIJdUyx15R95kcRj85ZX8H8OAU",
  "ChIJKzGHdEgM5EcR_OBTT3nQoEA", "ChIJG2LvQNCI4kcRKXNoAsPi1Mc", "ChIJ06tnGbxCCkgRsfNjEQMwUsc"))


## End(Not run)

googleway documentation built on Nov. 16, 2020, 9:08 a.m.