View source: R/google_map_urls.R
google_map_directions | R Documentation |
Opens Google Maps in a browser with the resutls of the specified directions query
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
)
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/maps/documentation/places/web-service/place-id).
If used, you must also specify an |
destination |
string of an address or vector of lat/lon coordinates |
destination_place_id |
a Google place id (https://developers.google.com/maps/documentation/places/web-service/place-id).
If used, you must also specify an |
travel_mode |
one of |
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 |
waypoint_place_ids |
vector of |
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.