[gdal-dev] GDALGetRasterStatistics() and bApproxOK, bForce

Radim Blazek radim.blazek at gmail.com
Thu Oct 11 08:39:09 PDT 2012


GDALGetRasterStatistics API doc:
"Returns the minimum, maximum, mean and standard deviation of all
pixel values in this band. If approximate statistics are sufficient,
the bApproxOK flag can be set to true in which case overviews, or a
subset of image tiles may be used in computing the statistics.
If bForce is FALSE results will only be returned if it can be done
quickly (ie. without scanning the data). If bForce is FALSE and
results cannot be returned efficiently, the method will return
CE_Warning but no warning will have been issued. This is a
non-standard use of the CE_Warning return value to indicate "nothing
done"."


My understanding is that if it is called with bApproxOK=false and
bForce=false and exact statistics (from all raster pixels) are not
available/cached, it should return CE_Warning. Instead, it is giving
estimated (from sample) cached statistics and it returns CE_None.

Is it expected? If it is, how can I test if exact statistics (from all
raster pixels) are available/cached (to avoid
GDALComputeRasterStatistics() if not necessary). Also, the meaning of
both params should be probably better described in doc.

Radim


More information about the gdal-dev mailing list