[gdal-dev] Geotiff nodata handling

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Mon Jun 23 01:02:24 PDT 2014


Even Rouault <even.rouault <at> mines-paris.org> writes:

> This is a rather tricky area indeed.
> 
> A few facts :
> - The concept of nodata value in GDAL is something per band, which leave 
> multi-band processing of nodata values subject to interpretation.
> - The TIFFTAG_GDAL_NODATA extension tag in TIFF only holds one nodata value 
> for all bands.
> - In gdalwarp utility, the warping option UNIFIED_SRC_NODATA is set to YES, 
> which means that a pixel is considered to be transparent if all bands hit 
> their respective nodata value (what you want here).
> - In gdaladdo, similar behaviour will be found if the dataset has a 
> NODATA_VALUES metadata item set to "0 0 0" for example, which makes an 
> implicit mask band of type GDALNoDataValuesMaskBand to be generated and 
> honoured. This metadata item is only set by the PNG driver for now. With VRT, 
> the metadata item could be also set for other datasets.
> 
> I guess QGIS only look band per band. A reliable way of solving this would be 
> to generate a RGBA dataset instead.

Just a word from my own experience: typical same-for-all-bands nodata values
 0 0 0 and 255 255 255 tend to burn holes into aerial and satellite images
within water bodies (black, more common) or on dry, light soils or
reflective areas like tin roofs (white, not as common). Something like pure
blue 0 0 255 occurs never in natural images and therefore would suit
perfectly as a nodata value in theory. I had once a whole bunch of such
images before I learned that many programs could not handle the transparency
and I had to reprocess them to 0 0 0. 

-Jukka Rahkonen-



More information about the gdal-dev mailing list