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 • Darren Wiens

Maps in Slack using quick-map

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…

Observations • Dustin Sampson

From Many to One: A Map Creation Story

A journey of creating a vessel tracking web map from a series of static vessel map images.

Observations • James Banting

COG—Huh! What is it good for?

Cloud Optimized GeoTIFF (COG) are geotiff files, like satellite imagery, that have been processed in a manner that makes it easy to consume for internet processing applications (read cloud). It…

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