创建动画地面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")