Share this question

Welcome to Teachnovice Q&A, where you can ask questions and receive answers from other members of the community.

This is a collaboratively edited question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

HTML link to open native Android or IOS map with off-road placemark showing?

0 like 0 dislike
383 views

My web application displays a Google map with a placemark showing an offroad location. I am converting it to run on mobile.

I can successfully open the native maps app in both IOS and Android with the following PHP code and link. (Tested on Samsung Galaxy S2 running Android 4.1.2):

$latlong ='-28.546604,153.540777';
echo '<a href="http://maps.apple.com?daddr='.$latlong.'">Take Me There</a>';

The problem is it does not put any placemark on the Native Google Map showing the offroad location. It just shows the driving route, which ends at the nearest street. Same result whether I click the Navigation or the Directions option at the bottom.

I also tested it with the direct (Android-only) link like this but it made no difference:

<a href="http://maps.google.com/maps?daddr='.$latlong.'">

I tried this form of the link instead:

<a href="geo:'.$latlong.'">Take Me There</a>

It goes directly into Google Maps native without asking any initial questions about which app to use, which I prefer, but it just displays a blank map screen. If I click on the icon in the top right corner of the map it then shows the normal navigation screen, but centered on my current location and there is no placemark for my destination.

Is there any way to force the native app to display a placemark at an exact specified offroad lat/long location please?

Found the answer myself. Solution was trivially easy thanks to Showing a marker at a geo:-url in Android Maps?

It was in fact exactly what my old code that displayed the Google map on the PC was doing. (Doh!) Just add a (label) value after the latlong to get the placemark to display. Like this:

$dest = 'my destination';
$latlong ='-28.546604,153.540777';
echo '<a href="http://maps.apple.com?daddr='.$latlong.'('.$dest.')">Take Me There</a>';

Tested and works fine on Android 4.1.2 (which is smart enough to use google maps app even though the link is pointing at Apple. I presume it works on Apple also.

asked Jan 24, 2015 by user2605793  
I've just tested this in Android 4.4, 4.3, 2.1 - all worked. iOS 7.0.4 & 6.1 work too. Falls back nicely to open Google maps in the browser if there's no Maps app installed. Good stuff!

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...