Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mobile web driving directions from current location

I'm building a mobile-version of a website, trying to have one-click link to launch Google Maps with driving directions to the business, from the user's current location. I have it working fine for the iPhone, but when testing on Android, it views 'Current%20Location' and tries to find a business called 'Current Location'. Here is my current code:

    <a href="http://maps.google.com/maps?saddr=Current%20Location&daddr=123 Street Rd,Cityville,MD,21098">Get Directions</a>

I need a universal string to search from the current location, and can't find a definitive answer anywhere online.

Thanks in advance for any help!

like image 571
jmarx34 Avatar asked Sep 12 '11 20:09

jmarx34


People also ask

Can Google Earth show driving directions?

Google Earth is great for looking at places and finding information about those places. But you can also use Google Earth to map driving directions, just as you can with Google Maps.


1 Answers

I am doing the same thing and now have it working on Android. I don't have an iPhone so I have no way of testing on that. You should leave the saddr parameter blank in the URL, and Google Maps will then prefill it with the user's current location. Also, use + signs instead of spaces in the destination address. Here's the corrected URL:

http://maps.google.com/maps?saddr=&daddr=123+Street+Rd,Cityville,MD,21098

like image 189
Derrick Miller Avatar answered Sep 20 '22 08:09

Derrick Miller