It is not uncommon for raster data to be large and unruly. Creating tiles is one way to deal with these large datasets and speed up rendering. This post introduces a few handy tools for dealing with raster data while walking through the process of combining multiple raster files to create tiles for a super-overlay for a nice clean visual output that renders more efficiently (particularly in Google Earth). All from the command line.

For this example, I have a number of jpg images that have large amount of white area that was not recognized as nodata, which can be seen by adding the imagery over a satellite image. Furthermore, when creating a vrt a black nodata bounding box is created around the extent of the combined images. You can see both in the image below. We want to hide both sets of no data before we create the tiles for the super-overlay.

What you’ll need:

Step 1: Create a vrt

gdalbuildvrt -srcnodata 255 -vrtnodata 0 /AllImages.vrt  /Images/*.jpg

The vrt (virtual dataset) in our case is allowing us to reference a number of datasets to treat and view them as one. –srcnodata 255 sets cells with the value of 255 (white) as the source’s nodata and –vrtnodata 0 sets black, created by building a vrt, as nodata as well. /AllImages.vrt is your output. /Images/*.jpg is your input. The *.jpg makes sure all jpg files in the images folder are added to the vrt. Now all nodata values will be transparent. Hooray.

Step 2: Create those tiles!

gdal2tiles.py -p geodetic -k Desktop/TestImages.vrt

Tiles speed up rendering by creating tiles of various resolutions and only displays tiles that are ‘in view’. Lower resolution tiles are displayed when viewing data zoomed out and higher resolution tiles as you zoom in. –p geodetic sets the profile of the data -k forces the creation of the KML for the super-overlay.

Step 3: View your super-overlay in Google Earth

Open up the doc.kml file that was created and check out you sweet output in Google Earth. Google Earth drapes the imagery over to topography making your raster images 3D. Pretty slick.

Sharing options

Observations • Tomer Rockman

STAC it up – A STAC tutorial

In this post we describe the process of taking a federal Canadian dataset and creating a SpatioTemporal Asset Catalog (STAC) using python.

Observations • Gordon Logie

Wildfires and Flood Damage

A data-backed research project examining linkages between the wildfires and subsequent flood damages that occurred in BC, 2021.

Observations • Will Cadell

Supply Chain Disruption and Geography

Geospatial Trend Report March 2022 – Will discusses recent supply chain disruptions and how geospatial plays a role in increasing the reliability of our global supply chain infrastructure.

Need a geospatial partner?

Our team complements organizations like yours—by providing on-tap access to geospatial, analytics, and mapping expertise.

Let’s talk

Join our team?

We’re always looking for skilled technologists to help us build the future of geospatial. Got a minute to find out more about us?

Working Here

Sharing options