Current Location - Google Maps - Link to Directions
Google MapsGoogle Maps Problem Overview
I'm trying to do what seemed to be an easy thing but has resulted in some confusion. I'm trying to have a link going to Google Maps with the destination address pre-filled and the from address to inherit the user's current location. From what someone else had instructed, if I used 'current location' as the 'from address', it'd do everything for me.
Instead, when I access the URL from a different location, it's still loading the original "current location" and not the actual current location.
I'm sure it's something stupidly easy, but I'm hoping that someone could point me in the right direction.
The link can be found here.
Google Maps Solutions
Solution 1 - Google Maps
For those still looking, here are some methods of linking to Google Maps:
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
Here is a post I made that I will keep updated as there are some even newer ways to do this!
Solution 2 - Google Maps
Use My Location instead:
https://maps.google.com/?saddr=My%20Location&daddr=myDestinationAddress
Current Location only works on OS'es with English locale setup.
I haven't found any documentation on this. However leaving saddr blank as suggested here https://developers.google.com/maps/documentation/ios-sdk/urlscheme will prompt the user to input start address.
Solution 3 - Google Maps
The answers of GreatBlakes and Jon Alslund-Lanthén suggest a way that sometimes gives you the right result but that can fail if the language of your user isn't English.
As of 2019, the best way seems to be:
https://www.google.com/maps/dir/?api=1&destination=Googleplex,+1600+Amphitheatre+Pkwy
Solution 4 - Google Maps
Also, you can try to use
https://maps.google.com/?daddr=53.9187068,27.5862874
It is works for me on android and ios at least. May be usefull. More details here : https://developers.google.com/maps/documentation/ios/urlscheme?utm_source=welovemapsdevelopers&utm_campaign=GM-for-iOS-sdk-1-7
Solution 5 - Google Maps
Try taking out a load of the information, and using 'Current+Location' and, oddly, using .co.uk rather than .com.
The link https://maps.google.co.uk/maps?t=m&f=d&saddr=Current+Location&daddr=312%20Ponce%20De%20Leon%20Boulevard,%20Coral%20Gables,%20FL works as expected for me (Win7, Chrome and IE9, Android Chrome).
Solution 6 - Google Maps
My+Location queryString doesn't work. But Current+Location queryString value is good work.
True link
https://www.google.com/maps?saddr=Current+Location&daddr=36.8957642,30.7089634
Solution 7 - Google Maps
If you make the destination and the current location the same that will work.
So you should copy/past the destination address also in to my location, than plan route and copy the URL.
This will work
Solution 8 - Google Maps
I am assuming you want this link to open on a mobile phone.
None of the strings mentioned populated my actual GPS Location on iOS 14 or the recent versions of android.
This is what did work for me,
https://www.google.com/maps/dir//Address1/Address2
// (double slashes intended) - indicates a custom starting point.
On desktop it leave this field unpopulated, but on mobile it takes your actual GPS location.
Looks like I do not need a google api key after all.
Solution 9 - Google Maps
What you expect to be the users location is not what you expect, "current location" will be taken by google as any other address, and google tries to find a place that matches the query.
When somebody told you that "current location" will force google to resolve the location of the user, this is wrong.
You may geolocate the user on your own and then create the link based on the geolocation-result.