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 • Will Cadell

Our Mapbox Services Partnership

For us, geospatial has always been about the consumer, or commercial applications. For this reason, we use Mapbox tools and services. Their technology is thoughtfully designed and enormously…

teal and red abstract painting

Observations • Will Cadell

/quick-map for Slack Update

Sometimes a chat needs a map, sometimes a map needs a chat. Either way, we created /quick-map last year to provide that functionality in Slack, the leading corporate…

gray conveyor between glass frames at nighttime

Observations • Will Cadell

Prescient Computing

Our community is perfectly positioned to evolve from analyzing landscapes retrospectively to looking forward. The next ‘killer app’ for geospatial isn’t an app at all, it’s probably the…

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