[gdal-dev] building overviews and ignoring NODATA?

Etienne Tourigny etourigny.dev at gmail.com
Tue Nov 20 15:26:51 PST 2012


Hi Even

thanks for the info - I created a ticket (#4904) so it's not forgotten
and added sprice in CC - although he hasn't seemingly been active in
gdal for a few years.

Etienne

On Tue, Nov 20, 2012 at 8:36 PM, Even Rouault
<even.rouault at mines-paris.org> wrote:
> 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