有没有办法修复 Google 地球专业版中 .kml 文件上的 LineStrings 切断问题?

问题描述 投票:0回答:1

我正在使用 python 库 simplekml 制作一个 .kml 文件,该文件显示连接机场的路线,用 Points 显示机场,用 LineStrings 显示可能的航班。生成的 .kml 文件在 Google 地球网站上显示良好,但在 Google 地球专业版上它会根据所应用的缩放而被切断。

我尝试弄乱 LineString 属性,看看是否遗漏了任何内容,但到目前为止没有任何效果。我的代码如下:

        for i in range(len(path)):
            airport_coords = (
                airports_df[airports_df['Code'] == path[i]]['Longitude'].values[0],
                airports_df[airports_df['Code'] == path[i]]['Latitude'].values[0]
                )
            point = kml.newpoint(name=path[i], coords=[airport_coords])
            point.style.iconstyle.icon.href = 'http://www.gstatic.com/mapspro/images/stock/1417-trans-airport.png'
            point.style.iconstyle.scale = 3
            if i > 0:
                last_coords = (
                    airports_df[airports_df['Code'] == path[i-1]]['Longitude'].values[0],
                    airports_df[airports_df['Code'] == path[i-1]]['Latitude'].values[0]
                    )
                line = kml.newlinestring(name='Line', coords=[last_coords, airport_coords])
                line.style.linestyle.width = 3
                line.style.linestyle.altitudemode = simplekml.AltitudeMode.clamptoground
                line.style.linestyle.tessellate = 1
                line.style.linestyle.color = simplekml.Color.red

如您所见,我增加了线宽,将高度模式设置为固定在地面上,并将细分设置为 1。

下面是线切断的示例图像: Line cutting off in Google Earth Pro

Line not cutting off in Google Earth, regardless of the zoom

python kml simplekml
1个回答
0
投票

事实证明,

tessellate
altitudemode
并不是线条样式的一部分。而不是:

line.style.linestyle.altitudemode = simplekml.AltitudeMode.clamptoground
line.style.linestyle.tessellate = 1

本来应该是:

line.altitudemode = simplekml.AltitudeMode.clamptoground
line.tessellate = 1
© www.soinside.com 2019 - 2024. All rights reserved.