Is there a "map:" URI prefix to launch map application? (like mailto: or tel:)
Asked Answered
H

6

28

Is there such prefix for launching map application on phones,

<a href="map:21st,High Street, London">Toto's home</a>

like can do

<a href="mailto:[email protected]">Toto's mail</a>
Heartsick answered 26/5, 2012 at 20:46 Comment(2)
Ah, getting my terms confused. The correct term for this is URI schema name (or sometimes just "protocol").Compassion
geo: is the generic one, if Android and Google Maps is your main target, simply adding a link to google maps will do the trick even better e.g. setting up a track: https://www.google.com/maps/dir//URLENCODEDADDRESS (empty part (//) indicates starting point is your current destination)Ennoble
S
14

geo: is an officially-recognised URI scheme, and maps: may be implemented in some clients.

https://en.wikipedia.org/wiki/Geo_URI_scheme

Souse answered 26/5, 2012 at 20:51 Comment(6)
It would be interesting to have some form of "works here" list... even if very vague, but showing if usage is practical or not.Compassion
maps:q=... works in Safari on the iPad and starts the maps app.Souse
geo: works on Android, maps: or maps:q= don't thx, it would be perfect if it could launch maps.google on desktop browser thoughHeartsick
finally it's more efficient with maps.google.com?q= , supported on desktop and can do geocodingHeartsick
maps: is also supported on Windows 10 in the (Bing) Maps app.Fist
maps:q= works on osx and ios, I didn't get it working on windows/android. I couldn't get geo: to work.Pegmatite
A
8

In each planform:

Apple

Documentation

Example: <a href="http://maps.apple.com/?ll=12.34567,8.90123">

Android:

Documentation

Example: <a href="geo:40.726966,-74.006076">

Windows Phone:

Documentation

Example: <a href="bingmaps:?cp=40.726966~-74.006076">

Ageless answered 6/9, 2015 at 11:8 Comment(0)
P
7

Both of the previous answers are correct in their own way but did not provide a succinct example.. So here goes:

Use:

  <a href="geo://?q=My+address+here">View On Map</a>

Works on Android & Apple in my tests.

Pufahl answered 21/5, 2014 at 2:53 Comment(1)
2022; works fine on Android!Superhuman
A
4

I don't have enough of a reputation to add a comment to ryan knell's answer above but, having recently implemented a geo uri feature into the Share panel of the OpenStreetMap site, I'd like to point out that there's no "//" in that scheme. It's spelled out quite clearly, with examples, in RFC 5870.

Antiproton answered 27/6, 2015 at 22:28 Comment(0)
M
4

Apple uses link with the maps:// protocol now too, as far as I know, only Apple Maps supports it (tested on Mac OSX 10.11 El Captain).

Example: maps://maps.apple.com/maps?daddr=48.851925,2.337141

So, to list them all, there are the protocols: geo:, bingmaps:, maps:, or linking to the various websites, eg: https://goo.gl/maps/VZG3rV6cRGE2.

Marthena answered 24/10, 2015 at 15:6 Comment(1)
maps: is supported by the Bing Maps app (on Windows, at least), too.Fist
T
0

If you simply do this...

<a href="http://maps.apple.com/?q=123+Main+etc...">View on map</a>

If the browser is on iOS/Mac, the native maps app will launch (doesn't matter the browser). If on android/windows/other, maps.apple.com will redirect to maps.google.com

Docs: https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html#//apple_ref/doc/uid/TP40007894-SW1

Thallus answered 21/3, 2014 at 23:32 Comment(2)
In my testing this takes us to a web version of the maps app - It does not launch the native maps application.Pufahl
The link worked for me on iOS 15.3 - it opened the native maps app.Archeozoic

© 2022 - 2024 — McMap. All rights reserved.