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
mountain during golden hour

Observations • Will Cadell

Sparkgeo & N51

Sparkgeo is very excited to be co-hosting N51 in Banff this year. Come and let the scenery take your breath away, while N51 stimulates your geospatial ideas.

selective focus photography of licensed plate with open text hanged

Observations • Dan Ormsby

FOSS4G UK 2022 – Sparkgeo represent at key open-source conference

The UK “free and open-source software for geo” (FOSS4G) community came together on November 17th to celebrate PostGIS Day.

closeup photography of clear glass window closed

Observations • Darren Wiens

How to use SVG Filters on Web Maps

Here at Sparkgeo, while we often prefer to provide answers over visualizations, we still make a lot of web maps. And when we do, we take pride in…

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