Map Links
The maps URL scheme is used to show geographical locations and to generate driving directions between two points. If your app includes address or location information, you can use map links to forward that information to the Maps app on iOS.
Unlike some schemes, map URLs do not start with a “maps” scheme identifier. Instead, map links are specified as regular http links and are opened either in Safari or the Maps app. The following examples show the strings you would use in Safari and in a native app to show a map of the city of Cupertino, California in the Maps app.
HTML link:
<a href="http://maps.apple.com/?q=cupertino">Cupertino</a>
Native app URL string:
http://maps.apple.com/?q=cupertino
The following examples show the strings you would use to provide driving directions between San Francisco and Cupertino:
HTML link:
<a href="http://maps.apple.com/?daddr=San+Francisco,+CA&saddr=cupertino">Directions</a>
Native app string:
http://maps.apple.com/?daddr=San+Francisco,+CA&saddr=cupertino
URLs that contain no path parameters or that contain specific map paths are opened in Safari and displayed there. For example, URLs based on the paths http://maps.apple.com/, http://maps.apple.com/maps, http://maps.apple.com/local, and http://maps.apple.com/m are all opened in Safari. To open a URL in the Maps app, the path must be of the form http://maps.apple.com/?q.
The rules for creating a valid map link are as follows:
The domain must be
maps.apple.com.The path cannot be
/maps/*.A parameter cannot be
q=*if the value is a URL (so KML is not picked up).The parameters cannot include
view=textordirflg=r.
Table 1 lists the parameters supported by iOS along with a brief description of each.
Parameter | Notes |
|---|---|
q= | The query parameter. This parameter is treated as if it had been typed into the query box by the user on the |
near= | The location part of the query. |
ll= | The latitude and longitude points (in decimal format, comma separated, and in that order) for the map center point. |
sll= | The latitude and longitude points from which a business search should be performed. |
spn= | The approximate latitude and longitude span. |
sspn= | A custom latitude and longitude span format used by Apple. |
t= | The type of map to display. |
z= | The zoom level. |
saddr= | The source address, which is used when generating driving directions |
daddr= | The destination address, which is used when generating driving directions. |
© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-12-13)