Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Current Location - Google Maps - Link to Directions

Tags:

google-maps

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.

like image 815
Brian Schroeter Avatar asked Feb 23 '13 15:02

Brian Schroeter


People also ask

How do I get Google Maps to show my current location?

On the Android smartphone or tablet, open the Settings app. Tap Location. At the top, switch location on.


2 Answers

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!

like image 136
GreatBlakes Avatar answered Dec 04 '22 19:12

GreatBlakes


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.

like image 35
Jon Alslund-Lanthén Avatar answered Dec 04 '22 19:12

Jon Alslund-Lanthén