Opened 11 years ago

Closed 5 years ago

#4904 closed defect (wontfix)

gdaladdo -mode should not ignore nodata values

Reported by: etourigny Owned by: etourigny
Priority: normal Milestone: closed_because_of_github_migration
Component: Algorithms Version: unspecified
Severity: normal Keywords:
Cc: sprice

Description

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.

Comments from Even on the ML:

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.

Based on his comments and linked bug, I have determined that a simple fix would be to calculate occurences for each value, regardless of nodata value / pabyChunkNodataMask.

Filing this bug so it doesn't get lost - for now I am using a workaround of removing nodata value before gdaladdo (gdal_translate -a_nodata none), and then setting nodata afterwards. Not ideal but it works.

Change History (2)

comment:1 by etourigny, 11 years ago

Oh - added sprice (Seth Price) in CC - if you read this and have any comments please add them here.

comment:2 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.