-1

The goal is to generate a url similar to this:

https://www.google.com/maps/dir/Bank+of+America+Financial+Center,+West+Dickson+Street,+Fayetteville,+AR/36.0665132,-94.1683564/@36.0666112,-94.1685074,20.5z/data=!4m24!4m23!1m20!1m1!1s0x89e60a1eeb4250dd:0xccaa89765c751072!2m2!1d-94.1683167!2d36.0663015!3m4!1m2!1d-94.1670086!2d36.06649!3s0x87c96edc06ed02d9:0xe92e6aa200c35b43!3m4!1m2!1d-94.1577513!2d36.0680627!3s0x87c96ed16b367e35:0xd874589e93cbbf83!3m4!1m2!1d-94.1685859!2d36.0672041!3s0x87c96edc39a53117:0x7b5afe32bea48704!1m0!3e0

Google maps generally finds shortest paths between distinct points. We have an algorithm that generates an array of lat long points in a poly line. In google maps you can manually drag portions of a route to view the desired path, poly line, instead of the shortest. The problem is generating a url given a poly line. as you can see in the above URL it has the destination points as well as some of the lat longs but there is extra information we can't find documentation on and have not been able to reverse engineer.

Does anyone know how google maps generates urls for poly lines of simple non destination lat longs

xomena
  • 31,125
  • 6
  • 88
  • 117
  • Use [Google Maps URLs](https://developers.google.com/maps/documentation/urls/guide#directions-action) with waypoints similar to this answer https://stackoverflow.com/a/46910653/5140781 – xomena Apr 05 '18 at 20:49
  • I don't want way points that are individual destinations I want one seamless route. When using waypoints it only shows you the distance to your next waypoint instead of the distance of the entire route as well as the next point of navigational interest. Basically we don't want the route to think you have arrived at a destination every time you make a turn. – Kurt Westerman Apr 05 '18 at 21:32

1 Answers1

0

You can use the unofficial, undocumented, and unsupported older Google Maps URL scheme, which includes a via parameter that allows you to specify the indices (zero-based) of the waypoints that should not be stopovers:

https://www.google.com/maps?saddr=Bank+of+America,703+W+Dickson+Street,+Fayetteville,+AR+72701&daddr=36.066481,-94.167010+to:36.068063,-94.157744+to:36.067205,-94.168591+to:701+W+Dickson+St,+Fayetteville,+AR+72701&dirflg=d&via=1,2,3

Do note that this not supported. Google may change or even remove the old URL scheme, causing your link to potentially break in the future, in which case you'll have to use the officially documented Google Maps URL scheme:

https://www.google.com/maps/dir/?api=1&origin=Bank+of+America,703+W+Dickson+St,+Fayetteville,+AR+72701&destination=701+W+Dickson+St,+Fayetteville,+AR+72701&travelmode=driving&waypoints=36.066481,-94.167010%7C36.068063,-94.157744%7C36.067205,-94.168591

You may also want to file a feature request in Google's Public Issue Tracker to allow for the official Maps URL scheme to allow non-stopover waypoints.

Preston
  • 856
  • 5
  • 6