Search code examples
javascriptgoogle-maps-api-3

Google Maps Directions API Equivalent URL


Been searching for an answer, can't find one. I'm using the Google Maps V3 API to get directions and a map. All this is OK ...

But I want to provide a bog-standard A-tag link to the equivalent directions on Google maps itself. I have 2 postcodes. How can I generate a Google Maps directions URL based on 2 postcodes or my

 google.maps.DirectionsService

I'm going to use the URL to produce a "View on google maps" button and a "printable" button.

Cheers! Aiden


Solution

  • See the link in this Stackoverflow question

    http://www.seomoz.org/ugc/everything-you-never-wanted-to-know-about-google-maps-parameters

    saddr=

    Sets the starting point for directions searches. You can also add text into this in brackets to bold it in the directions sidebar.

    daddr=

    Sets the end point for directions searches, and again will bold any text added in brackets.You can also add "+to:" which will set via points. These can be added multiple times.

    Example