Creating a KML image overlay for a raster
Google Earth is one of the most widely available geospatial viewers in existence. The XML data format used by Google Earth for geospatial data is called KML. The Open Geospatial Consortium adopted KML as a data standard. Converting rasters into a KML overlay compressed in a KMZ archive file is a very popular way to make data available to end users who know how to use Google Earth.
Getting ready
We will use the SatImage raster again available at the following URL if you haven't downloaded it from previous recipes:
https://github.com/GeospatialPython/Learn/raw/master/SatImage.zip
Place this raster in your /qgis_data/rasters
directory.
How to do it...
In this recipe, we'll create a KML document describing our image. Then we'll convert the image to a JPEG in memory using GDAL's specialized virtual file system and write all of the contents directly to a KMZ file using Python's zipfile
module.
Start QGIS.
From the Plugins menu, select Python Console.
We need...