简体   繁体   English

如何将 KML 文件动态加载到谷歌地图并进一步加载到折线?

[英]How to load dynamically KML file to google maps and further to polyline?

I could not find the answer, how to load dynamically on the map KML file using input file?我找不到答案,如何使用输入文件在 map KML 文件上动态加载? Important is that this operations should be done only on client side without uploading to server whether it is possible using JavaScript?重要的是这个操作应该只在客户端完成而不上传到服务器是否可以使用 JavaScript? As a result JavaScript should extract only the coordinates and insert them into polyline but it is a matter of secondary.结果 JavaScript 应该只提取坐标并将它们插入折线,但这是次要的问题。

My current concept: link我目前的概念:链接

I found an interesting example, but here's a copy/paste and api v2: link我发现了一个有趣的例子,但这是一个复制/粘贴和 api v2:链接

Maybe to insert to polyline loaded kml this: link parser would be great?也许插入到加载 kml 的折线:链接解析器会很棒吗?

You might want to try the File API in HTML 5. It now allows reading the content of a local file.您可能想尝试 HTML 中的文件 API 5。它现在允许读取本地文件的内容。 Here's a nice tutorial .这是一个很好的教程 Unfortunately some browsers don't support it, but it's the only way I know of outside of using flash or java. Once you have the KML file contents in Javascript, you can use the geoxml3 parser you referenced to parse the data and display on your map.不幸的是,有些浏览器不支持它,但这是我所知道的除了使用 flash 或 java 之外的唯一方法。一旦你在 Javascript 中有了 KML 文件内容,你就可以使用你引用的geoxml3解析器来解析数据并显示在你的map。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM