2

In the old Maps URLs API, you could add "&dirflg=dt" in the URL.

Here's an example URL using the new API taken from Google's official pages here:

https://www.google.com/maps/dir/?api=1&origin=Google+Pyrmont+NSW&destination=QVB&destination_place_id=ChIJISz8NjyuEmsRFTQ9Iw7Ear8&travelmode=driving

In the Google official pages, I was unable to find anything related to sending it flags to avoid tolls so I'm not even sure if it is possible with the new API.

Does someone have any info to enlighten me with? Thanks for reading. :)

2 Answers2

3

This is not possible with the Maps URL in this version, but you can do this manually after loading the directions.

You can try this:

  1. Load the URL. (eg.: https://www.google.com/maps/dir/?api=1&origin=Google+Pyrmont+NSW&destination=QVB&destination_place_id=ChIJISz8NjyuEmsRFTQ9Iw7Ear8&travelmode=driving)
  2. On the left part of the screen, click OPTIONS.
  3. Under Avoid, check Tolls.

However, if you want this functionality to be in the parameters, you can send your ideas by going in the Maps URLs Documentation and click SEND FEEDBACK. Or you can submit this as a Feature Request in Google Issue Tracker

Hope this helps!

tomjosef
  • 895
  • 6
  • 21
  • Interesting. It would very nice to indeed have this as it's pretty useful. Thanks for confirming my suspicions that it's unavailable and mentioning the links so I can request this feature to be added! :) – RichyDavisWindow3 May 18 '18 at 04:27
3

This is possible, but you have to use "undocumented" features.

Warning: Since these are not documented features, they probably aren't official and likely subject to change without notice. Use in production at your own risk.

tldr:

https://www.google.com/maps/dir/{origin}/{destination}/data=!4m3!4m2!2m1!2b1

Plug in origin and destination and it should load directions, avoiding toll roads.

Explanation:

Here, we are using Google's own data/options string (see: "data=") to get the desired functionality. It is meant to be used by the Google Map's web app itself to communicate options selected on the page. This article (and the ones following it) explain how to create your own "data=" strings to customize how the map is configured. It's quite comprehensive, but like I said above, its not an official feature.

Bryan W
  • 163
  • 1
  • 7