[gdal-dev] gdalinfo -mm also report n (number of grid cells that are not nodata)

Markus Metz markus.metz.giswork at gmail.com
Fri Jun 15 13:21:23 PDT 2018


On Thu, Jun 14, 2018 at 10:55 PM, Even Rouault <even.rouault at spatialys.com>
wrote:
>
> > > Wanna take a crack at implementing this ?
> >
> > Too many API changes required, starting with GDALGetRasterStatistics(),
> > GDALComputeRasterStatistics() and all else following. There must be an
> > easier solution. But thanks for your offer:-)
>
> We don't necessary need to change the API. The function could just set the
> metadata item, and the client would read it with GDALGetMetadataItem()

Thinking about it, I do not want to support approximate statistics,
therefore something like STATISTICS_VALID_RATIO does not work for me, only
something like STATISTICS_N_VALID which requires exact statistics.
Approximate statistics are confusing for users, unless it is made clear
that these statistics are approximations. E.g. a user calculates exact
statistics with some software other than GDAL and then wonders why results
are different between gdalinfo and that some software known to calculate
exact statistics.
>
> > Enhancement request: set STATISTICS_APPROXIMATE=UNKNOWN if it is
unknown. I
> > checked with some externally provided sample data and GDAL 2.3.0 does
not
> > report STATISTICS_APPROXIMATE.
>
> I didn't want to pollute statistics with STATISTICS_APPROXIMATE=NO when
exact
> computation has been done. So basically you have
STATISTICS_APPROXIMATE=YES or
> no STATISTICS_APPROXIMATE at all when exact computation has been done
(which
> is the normal assumption)

Looking at random samples, the normal assumption must be
STATISTICS_APPROXIMATE=YES if STATISTICS_APPROXIMATE is not set. IMHO, GDAL
should set STATISTICS_APPROXIMATE=YES unless GDAL itself has computed exact
statistics. If in doubt set STATISTICS_APPROXIMATE=YES.

I am aware it's a conflict between providing results quickly to users and
providing exact results to users which might take longer to get. I am for
exact results.

Markus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180615/392d75de/attachment.html>


More information about the gdal-dev mailing list