我需要创建一个 Wind Rose KML 文件,以便在 google Earth 中打开,如下图(类似于)。
我可以使用
windrose
python 模块创建风玫瑰,如下所示:
我知道如何使用
simplekml
模块在 python 中创建 KML 点和线,如下所示:
有人知道有什么软件包可以做到这一点吗? 或者知道如何做?
如果你在绘制windrose时使用matplotlib,请尝试使用以下选项保存无花果。
plt.axis('off')
plt.savefig('windrose.png', bbox_inches='tight', pad_inches=0, transparent=True)
获得图像文件后,在kml中生成地面叠加代码。
import simplekml
kml = simplekml.Kml(open=1)
doc = kml.newdocument(name='sample', open=1, visibility=0)
ground = doc.newgroundoverlay(name='windrose example')
ground.icon.href = 'windrose.png'
ground.altitudemode = simplekml.AltitudeMode.absolute
ground.altitude = 500.0
ground.latlonbox.north = 38.031368255615234
ground.latlonbox.south = 37.11344909667969
ground.latlonbox.east = 141.5791015625
ground.latlonbox.west = 140.4208984375
ground.visibility = 1
kml.save('sample.kml')
各个数值都需要调整。
如果您想了解更多关于地面覆盖物的信息,请参阅以下内容。
https://developers.google.com/kml/documentation/altitudemode#absolute