[gdal-dev] building overviews and ignoring NODATA?

Even Rouault even.rouault at mines-paris.org
Tue Nov 20 14:36:05 PST 2012


Le mardi 20 novembre 2012 21:14:12, Etienne Tourigny a écrit :
> 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?

Etienne,

Mode resampling was contributed by Seth Price in 
http://trac.osgeo.org/gdal/ticket/2347 . Perhaps you could see with him.

At first sight, I'd say that your arguments make sense, and that nodata should 
be treated as a regular value (like in nearest resampling). Ignoring nodata 
makes sense in bilinear or cubic resampling where you don't want to "average" 
with a dummy value.

> 
> Thanks
> Etienne
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list