[gdal-dev] building overviews and ignoring NODATA?

Etienne Tourigny etourigny.dev at gmail.com
Tue Nov 20 12:14:12 PST 2012


Hi all,

I just noticed that GDALBuildOverViews disregards all nodata pixels.
While this is useful in many cases, sometimes it can be desired to NOT
overlook nodata pixels.

For example, I have a raster of sparse data (many nodata pixels), that
I am using gdaladdo to make down-sampled versions. The workflow is:
use gdaladdo with "mode" resampling and then gdal_translate to get
final downsampled image.

A problem occurs on the edges of valid data, overview pixels get set
to a value which is clearly non-dominant in the higher-resolution data
- that is mostly nodata pixels. As the algorithm disregards the nodata
pixels, result is the most frequent valid data pixel.

Would it be easy to fix this, or am I better off just making a copy of
the file without nodata, and then adding the nodata later?

Thanks
Etienne


More information about the gdal-dev mailing list