Search code examples
google-mapsembed

Google embedded map not showing route with selected options (eg. avoid toll/highway)


When creating a map with options selected like avoid toll road or highway, the embedded map shows the fastest way instead the previously calculated route.

Is there any key/value pair to add to iframe's source to turn on this options? The API has this options however ot doesn't work here: ...&avoid=tolls|highways

Example: https://goo.gl/maps/cyY4y map disregards options


EDIT: When embedding, the options are added to the source but ignored. If a proper API key is added and these options are added with API options, it works.


Solution

  • This worked for me

    https://www.google.com/maps/embed/v1/directions?
    origin=2151+Fót,+Fehérkő+utca+2,+Hungary
    &destination=Brezova-Gokartland,+Visonta,+Brezova+tanya+3271,+Hungary
    &key=MY_KEY&avoid=tolls|highways
    

    enter image description here