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

Radim Blazek radim.blazek at gmail.com
Thu Oct 11 10:07:31 PDT 2012


On Thu, Oct 11, 2012 at 6:50 PM, Frank Warmerdam <warmerdam at pobox.com> wrote:
> Radim,
>
> I gather the problem is that GDAL cannot tell whether saved statistics in
> metadata are exact or not, right?

It should be possible, at least .aux.html has <Approximate>1</Approximate>.

In any case, if it is not sure that cached stats are exact, it should
return CE_Warning if bApproxOK=false and bForce=false, I think.

> I don't have any real plan to resolve
> this unfortunately.   I ticket might be prudent.

https://trac.osgeo.org/gdal/ticket/4857

Radim

> Best regards,
> Frank
>
> On Thu, Oct 11, 2012 at 8:39 AM, Radim Blazek <radim.blazek at gmail.com>
> wrote:
>>
>> 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
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>
>
> --
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam,
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Software Developer
>


More information about the gdal-dev mailing list