English 中文(简体)
Open the iPhone map application via link to Google maps with KML as query
原标题:

How does one force the iPhone map application to open when the link on a web page goes to maps.google.com/?q=http://example.com/mapdata.kml?

If I open the map application and specifically put http://example.com/mapdata.kml in the query box, all the data is loaded correctly. But if I use http://maps.google.com/?q=http://example.com/mapdata.kml, the map application loads but no data is loaded and nothing is in the query box.

The typical queries work, like q=cupertino or q=[latitude,longitude]. It seems to be the kml link that s broken.

Has anyone gotten this to work? Is this supported? Do you have to URI encode the query?

最佳回答

Your question interested me so I did a little looking around at the Apple URL Scheme Reference. It says the following:

Although the Maps application supports many of the Google Maps parameters and queries, it does not support them all. The rules for creating a valid map link are as follows:

The domain must be google.com and the subdomain must be maps or ditu.

The path must be /, /maps, /local, or /m if the query contains site as the key and local as the value.

The path cannot be /maps/*.

All parameters must be supported. See Table 1 for list of supported parameters.

A parameter cannot be q=* if the value is a URL (so KML is not picked up).

The parameters cannot include view=text or dirflg=r.

If I m reading that right, it doesn t look like what you re wanting is supported, however, it s interesting that you can type the full kml URL into the maps app directly and have it work. That seems like a bug on Apple s part. I would just start throwing parameters at it and see what happens. That s always fun. ;-)

Best Regards,

p.s. That is a nice sticker. I d prefer a bounty, but looks like you haven t racked up enough SO points to offer that yet. ;-)

问题回答

This link will do what you want

<a href="maps:q=http://example.com/mapdata.kml">

but it will only work on iOS so make sure you check the user agent etc and use a normal maps url on non-iOS

<a href="http://maps.google.com?q=http://example.com/mapdata.kml">

The maps URL in simplest form

maps:q=GivenTitle@latitude,longtitude





相关问题
How to decide the current point reach on google map?

How to decide the current point reach on google map? I have a list of points (pickup points) of a route that I want to show in my google map with polyline. Now i have to get the current location of ...

Topographical or relief data in Map APIs

I was wondering if anyone knew of any map APIs that offer topographical or relief data? I ve had a quick look at Google and Bing APIs, but could find nothing there. Google allow you to view a map as ...

Using maps on Windows Mobile

I m experimenting with maps on different mobile platforms. Getting Google Maps to work on Android was easy, following this tutorial. Getting the same to work on Windows Mobile is a different matter. ...

Adding a custom icon to a google map

I need a hand adding a custom icon to some Google Maps javascript. Code below for your reference: function populateMap() { var map = new GMap2(document.getElementById("map")); map.setCenter(new ...

RSS to KML Overlay

I m want to display my blog as a Google Map overlay (each post contains geotags). How can I dynamically create a KML overlay from an RSS? Or better, how can I create a loop (PHP) that would display ...

开放街道地图管理员

我需要开放Street的标记管理员。 地图,如山角地图。

热门标签