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
If api=1 is NOT present in the URL, all parameters are ignored and the default Google Maps app will launch, either in a browser or the Google Maps mobile app, depending on the platform in use (for example, https://www.google.com/maps).
Radar is the best alternative to the Google Maps API. Radar supports geocoding, search, and distance APIs with high-quality address and place data. Radar is more affordable than the Google Maps API, free up to 100,000 API requests per month and $0.50 per 1,000 requests thereafter.
Here are some standard HTML links for different Google Maps functions. I keep an updated post here.
//Spaces can be changed to "+" or encoded as "%20".
//Linking to a location (No directions)
https://www.google.com/maps?q=760+West+Genesee+Street+Syracuse+NY+13204
//No starting point (User input required to generate directions).
https://www.google.com/maps?daddr=760+West+Genesee+Street+Syracuse+NY+13204
//With a set location as starting point (Automatically generates directions with no user input required).
https://www.google.com/maps?saddr=760+West+Genesee+Street+Syracuse+NY+13204&daddr=314+Avery+Avenue+Syracuse+NY+13204
//With "My Location" as starting point (Automatically generates directions with no user input required).
https://www.google.com/maps?saddr=My+Location&daddr=760+West+Genesee+Street+Syracuse+NY+13204
//Current Location to Latitude and Longitude
https://www.google.com/maps?saddr=My+Location&daddr=43.12345,-76.12345
//Query search of a Latitude and Longitude
//Also shows setting a default zoom level
https://www.google.com/maps?ll=43.12345,-76.12345&q=food&z=14
//String search as destination
https://www.google.com/maps?saddr=My+Location&daddr=Pinckney+Hugo+Group
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With