打开本地KML文件在谷歌地图上的Andr​​oid图上、文件、KML、Andr

2023-09-04 02:58:29 作者:我的爱,营养不良°

我已经加载的KML文件到Android设备。什么是最简单的机制来加载一个KML文件到谷歌地图的覆盖?我不想上传KML文件到网上,但宁可在本地打开它。

I have loaded a KML file onto an Android device. What's the easiest mechanism for loading an overlay of that KML file into Google Maps? I do not want to upload the KML file to the web but would rather open it locally.

推荐答案

要KML加载到Android上的谷歌地图,而无需编写一个应用程序的,你可以创建一个小的HTML文件的某处GEO-URI链接到KML文件,然后点击任何Android的Web浏览器链接。

To load kml into Google Maps on Android without writing an app, you can create a little html file somewhere with a geo-uri link to the kml file and then click on that link in any Android web browser.

例如:假设您的KML文件位于 /sdcard/overlay.kml ,然后你写一个地理的URI链接是这样的:

For example: suppose your kml file is located in /sdcard/overlay.kml then you write a geo-uri link like this:

<html>
<head><title>Example KML link page using a geo-uri</title></head>
<body>
  <a href="geo:0,0?q=file:///sdcard/overlay.kml">overlay.kml</a>
</body>
</html>

点击链接可启动地图,然后地图将尝试加载和您的KML。

Clicking on the link will launch Maps and then Maps will attempt to load and your kml.

(显然,如果您的KML文件是一个Web服务器上的文件://部分可以被替换为 http://服务器)

(Obviously if your kml file is on a web server the file:// part can be replaced with http:// servername)

但被警告说,地图的Andr​​oid版本没有出现来处理KML元素作为桌面版本(或桌面谷歌地球)的同一版本/范围。

Be warned however that the Android version of Maps does not appear to handle the same version/range of kml elements as the desktop version (or desktop Google Earth).