Opened 17 years ago

Closed 16 years ago

#1372 closed defect (fixed)

gdaladdo does not ignore NODATA values

Reported by: jszatmary@… Owned by: warmerdam
Priority: normal Milestone: 1.5.0
Component: GDAL_Raster Version: 1.4.0
Severity: normal Keywords: overview average nodata
Cc: jay@…

Description (last modified by warmerdam)

Contrary to documentation gdaladdo does not ignore NODATA values when averaging. This was confirmed by warmerdam@pobox.com (via e-mail discussions.) Additionally, as a note, no special case handling appears to exist in the overview code for RGBA TIFF files (a special-case can be seen for RGB.)

Attachments (3)

gdal-1.4.2-fix-overview-nodata.patch (3.3 KB ) - added by Even Rouault 17 years ago.
gdal-1.4.2-fix-overview-nodata-with-strict-nodata.patch (5.5 KB ) - added by Even Rouault 17 years ago.
gdal-1.4.2-fix-overview-nodata-with-strict-nodata-and-min-max.patch (10.1 KB ) - added by Even Rouault 17 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by Even Rouault, 17 years ago

The attached patch handles the case where the raster band has a NODATA value while computing average. I've only fixed the 'simple type' case, as I'm not sure of if it's revelant for the 'complex type' case. It fixes the problem for int16 tiff images converted from DTED with nodata samples. As the ticket I've submitted to mapserver about WCS interpolation (http://trac.osgeo.org/mapserver/ticket/2181), it could be interesting to have a 'STRICT_NODATA' mode where the NODATA value is not simply ignored but also propagated. I'll maybe propose a patch for this.

by Even Rouault, 17 years ago

comment:2 by Even Rouault, 17 years ago

See also ticket "[GDAL] #1721: [PATCH] GTiffDataset::IBuildOverviews doest not propagate NODATA to overview rasterband" : http://trac.osgeo.org/gdal/ticket/1721

comment:3 by Even Rouault, 17 years ago

An improved version of the patch that supports STRICT_NODATA mode. The '-strict_nodata' flag is added to gdaladdo. Man page updated accordingly.

comment:4 by Even Rouault, 17 years ago

Cumulative patch that adds minimum and maximum subsampling, only for simple data type (I guess minimum and maximum don't make sense for complex data type...)

comment:5 by Even Rouault, 17 years ago

Milestone: 1.5.0
Priority: highestnormal

I've commited in trunk in r12497 something very close to gdal-1.4.2-fix-overview-nodata-with-strict-nodata.patch.

comment:6 by warmerdam, 16 years ago

Component: defaultGDAL_Raster
Description: modified (diff)
Keywords: overview average nodata added
Resolution: fixed
Status: newclosed

I've removed the -propogate_nodata option which I feel is a bit to specialized to belong in GDAL (r12899), and added a test for nodata and average (r12897).

Closing as fixed.

Thanks Even!

Note: See TracTickets for help on using tickets.