Quick look image of a multi-image mosaic

For large mosaics it’s common for images to be delivered / processed in smaller tiles. Creating a quick look is a good way of visually checking the data and making sure there are no missing tiles. The combination of the GDAL Virtual Raster Format (VRT; http://www.gdal.org/gdal_vrttut.html), a text file containing links to the individual tiles and the -outsize option in GDAL translate provides a quick way of producing a mosaic. For recursively finding files the find command is used.

Therefore, to create the mosaic a total of three commands are used:

# 1) Recursively find files with the extension tif
# (you could use ls if there are in one directory)

find ./ -name '.*tif' > filelist.txt

# 2) Create a GDAL virtual raster
gdalbuildvrt -input_file_list filelist.txt virtualmosaic.vrt

# 2) Create a PNG 10  % of the size, scaled from 0 - 255
gdal_translate -of PNG -ot Byte -scale -outsize 10% 10% \
virtualmosaic.vrt quicklookmosaic.png

How successfully the pixel values scale will depend on the range of values in your input image. It your image looks odd try leaving of the scale option and setting the data type (-ot) to the same as the input image. You can then open with your normal viewer for remote sensing data and stretch the image in that (if you need a remote sensing data viewer TuiView is our recommendation).

If you remove the -outsize flag, gdal_translate can also be used to create the full size mosaic. As virtual rasters are handled like standard datasets in anything that uses GDAL you can use them as part of your processing chain, like you would a real dataset.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s