英文:
How to get LookAt data from KML file in Java
问题
这是一个名为LookAt的kml文件中的标签。如下:
<LookAt>
    <longitude>51.36863708496094</longitude>
    <latitude>35.7291434559867</latitude>
    <altitude>0</altitude>
    <heading>0</heading>
    <tilt>0</tilt>
    <range>0</range>
    <altitudeMode>absolute</altitudeMode>
</LookAt>
我需要获取这个标签的纬度和经度信息。我还使用了jak库。有人可以帮忙吗?
英文:
There is a tag called LookAt in the kml file. as below:
<LookAt>
    <longitude>51.36863708496094</longitude>
    <latitude>35.7291434559867</latitude>
    <altitude>0</altitude>
    <heading>0</heading>
    <tilt>0</tilt>
    <range>0</range>
    <altitudeMode>absolute</altitudeMode>
</LookAt>
I need to get the lat and long information of this tag.
I also use the jak library.
Can anyone help?
答案1
得分: 0
感谢回答 @CodeMonkey
最终答案如下:
Placemark placemark = (Placemark) folderFeature;
AbstractView abstractView = placemark.getAbstractView();
   if (abstractView != null) {
        if (abstractView instanceof LookAt) {
            LookAt lookAt = (LookAt) abstractView;
            lookAt.getLatitude();
            lookAt.getLongitude();
         }
    }
英文:
Thanks for the answer @CodeMonkey
The final answer is as follows:
Placemark placemark = (Placemark) folderFeature;
AbstractView abstractView = placemark.getAbstractView();
   if (abstractView != null) {
        if (abstractView instanceof LookAt) {
            LookAt lookAt = (LookAt) abstractView;
            lookAt.getLatitude();
            lookAt.getLongitude();
         }
    }
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论