如何创建支持动画地面叠加层的KML?


11

我有12张图像代表第1天到第12天的天气状况。我正在使用gdal2tiles从这些图像中的每张中生成地图图块。gdal2tiles还会生成一个KML文件,该文件可在Google Earth中用于显示图块。

但是,我想在所有12张图像中创建一个动画图层。Google Earth似乎支持KML文件中的动画(请参阅https://developers.google.com/kml/documentation/time#example2)。是否有任何工具可以创建这样的动画地面覆盖KML文件?gdal2tiles有能力吗?

非常感谢。-迈克


我最好的建议是遵循此评论者的建议:“ gis.stackexchange.com/questions/72550/… ”,并尝试“将您当前拥有的多个静态KML文件合并为一个带有多个时间戳标记的地标的 KML文件”。当gdal2tiles生成KML文件时,似乎可以使用该工具。抱歉,我不能提供更多。祝好运!
TheLastGIS

Answers:


8

创建动画地面KML文件的绝佳工具是simplekml“一个python软件包,可让您以最小的努力生成KML。”

以下是您在使用simplekml之前提到的TimeSpan示例的快速而肮脏的再现:

import simplekml
kml = simplekml.Kml()

ground1 = kml.newgroundoverlay(name='Blue Marble - Jan')
ground1.icon.href = 'http://mw1.google.com/mw-earth-vectordb/kml-samples/bmng12/files/BMNG-Jan.jpg'
ground1.gxlatlonquad.coords = [(-180,-90),(180,-90),(180,90),(-180,90)]
ground1.timespan.begin = "2004-01-01"
ground1.timespan.end = "2004-01-31"

ground2 = kml.newgroundoverlay(name='Blue Marble - Feb')
ground2.icon.href = 'http://mw1.google.com/mw-earth-vectordb/kml-samples/bmng12/files/BMNG-Feb.jpg'
ground2.gxlatlonquad.coords = [(-180,-90),(180,-90),(180,90),(-180,90)]
ground2.timespan.begin = "2004-02-01"
ground2.timespan.end = "2004-02-29"

ground3 = kml.newgroundoverlay(name='Blue Marble - Mar')
ground3.icon.href = 'http://mw1.google.com/mw-earth-vectordb/kml-samples/bmng12/files/BMNG-Mar.jpg'
ground3.gxlatlonquad.coords = [(-180,-90),(180,-90),(180,90),(-180,90)]
ground3.timespan.begin = "2004-03-01"
ground3.timespan.end = "2004-03-31"

# ...and so on with the other months

kml.save("TimeSpan_Example_simplekml.kml")
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.