Android API 支持 KML 文件吗?
Android 中有没有办法将 Google Earth 中的 KML 文件加载到地图小部件中?
具体来说,我希望尽可能轻松地加载在 Google Earth 中创建的已保存形状并覆盖地图小部件。以前有人尝试过这个吗?
Is there a way in Android to load KML files from Google Earth into a map widget?
Specifically I am looking to load saved shapes created in Google Earth overtop a map widget as easily as possible. Has anybody ever tried this before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个老问题,但如果有人偶然发现它,这个答案可能会有一些用处。
您的意思是以编程方式将 kml 文件添加到应用程序内的地图片段上吗?
如果是这样,您可以使用此方法。
缺点是您几乎无法控制 KML 图层的显示方式。您可以在此处找到完整的参考:https://developers.google.com /maps/documentation/android-api/utility/kml
您还可以尝试使用 JAK 和 JAXB 将 kml 文件解析为 POJO,并以编程方式绘制该数据。如果你能让它发挥作用,那就相对无痛。 https://labs.micromata.de/projects/jak.html
It is an old question but this answer might be of some use if someone happens to stumble upon it.
Do you mean to add the kml file onto a mapfragment inside an app programmatically?
If so, you can use this method.
The downside is that you have little to no control as to how the kml layer is displayed. You can find a complete reference here: https://developers.google.com/maps/documentation/android-api/utility/kml
You can also try to parse the kml file to a POJO using JAK and JAXB and draw that data programmatically. If you can get it to work it is relatively painless. https://labs.micromata.de/projects/jak.html
看起来您可以在地图上加载 KML 文件,但没有像从 libkml 获得的编程访问权限。
It looks like you can load KML files on a map but there is no programmatic access like you would get from libkml.