Opened 10 years ago

Closed 3 years ago

#4576 closed defect (wontfix)

GDALRasterBand::ComputeStatistics() does not always call SetStatistics()

Reported by: bgp2000 Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: default Version: unspecified
Severity: normal Keywords:


The documentation says: "Once computed, the statistics will generally be 'set' back on the raster band using SetStatistics().", yet if the block (bApproxOK && GetOverviewCount() > 0 && HasArbitraryOverviews()) evaluates to true, that is not the case.

This might be a feature(not writing approximate data to the file) but it depends on how "generally" is interpreted. It seems rather arbitrary not to save the data in this case. At least the documentation could be clearer.

Change History (3)

comment:1 by Jukka Rahkonen, 7 years ago

I can find from the code of trunk/gdal/gcore/gdalrasterband.cpp only this in three places:

if ( bApproxOK && GetOverviewCount() > 0 && !HasArbitraryOverviews() )

I believe that there is a relation to issue #2108 "[PATCH] GDALRasterBand::ComputeStatistics() does not use arbitrary overviews"

If I understand right the special handling in done for ECW and JPEG2000 which have arbitrary overviews. Because of #2108 the statistics for those is computed from a quickly subsampled image which has a size of about 2500 pixels only.

I think it is a feature to not to write statistics back to the file in this case. If it affects ECW, JPEG2000 and perhaps MrSID the behaviour is not so arbitrary but sure worth clearer documentation.

comment:3 by Even Rouault, 3 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 if it is not already reported there.

Note: See TracTickets for help on using tickets.