I'm working on a web application that makes use of the Google Maps Directions API. I am trying to create a hyperlink below some dynamically created directions (using lat/lon coordinates as waypoints) that will allow a mobile user to view and interact with the same directions on their mobile device.
As an example, I have created a directions link with 3 waypoints made from lat/lon pairs. The first is to the Southwest of Atlanta (33.67,-84.61). The second is to the North (34.01,-84.33), and the third is to the Southeast (33.66,-84.10). (Think of drawing a simple "A" shape over the city of Atlanta.) Using several aging 3rd party guides and other StackOverflow answers, I've made the simplest version of a maps URL that seems to return my desired result. It looks like this:
http://maps.google.com/maps?f=d&saddr=33.67,-84.61&daddr=34.01,-84.33+to:33.66,-84.10
This directions URL works fine in a web browser, even a mobile one, but seems to have differing results in both iOS and Android native versions of the Google Maps application. Below are screenshots of some testing I was able to do on the above URL.
Android Google Maps app - Gives directions from the start address (saddr
) to the first waypoint and ignores anything else.
iOS 9 Google Maps app - Gives directions from the saddr
to the last waypoint and ignores points between!
The very same URL seems to play nice when you open it with:
Does Google officially document these URL routes somewhere? What parameters can I use to accomplish my goal of consistency for direction link behavior across mobile platforms?
We can request multiple stop directions to launch Google Maps like below,
Forming the Directions URL
https://www.google.com/maps/dir/?api=1¶meters
Usage:
For more examples reach out to official documentation.