如何从KML文件中在Java中获取LookAt数据

huangapple go评论69阅读模式
英文:

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();
         }
    }

huangapple
  • 本文由 发表于 2023年4月17日 15:11:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76032505.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定