Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 977
Aiden Bell Avatar asked May 01 '13 20:05

Aiden Bell


People also ask

What is the URL of Google Maps?

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).

What is the best Google Maps API alternative?

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.


1 Answers

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
like image 198
GreatBlakes Avatar answered Sep 24 '22 04:09

GreatBlakes