[GIS] How to create a KML that supports animated ground overlays

animationgdalkml

I have 12 images that represent weather conditions at day 1 through day 12. I am using gdal2tiles to produce map tiles from each of these images. gdal2tiles also produces a KML file that can be used in Google Earth to display the tiles.

However, I want to create an animated layer out of all 12 images.
Google Earth seems to support animation in KML files (see https://developers.google.com/kml/documentation/time#example2). Are there any tools to create an animated ground overlay KML file such as this? Is gdal2tiles capable of it?

Thanks a lot.
– Mike

Best Answer

A wonderful tool to create an animated ground overlays KML file is simplekml, "a python package which enables you to generate KML with as little effort as possible."

The following is a quick and dirty reproduction of the TimeSpan Example you mentioned before using simplekml:

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")