[QGIS-Developer] How to get estimated raster statistic without calc them?

Richard Duivenvoorde rdmailings at duif.net
Fri Jan 18 05:33:54 PST 2019

Hi Luigi,

I cannot be of help, but I think I had exactly this problem then you,
when there is a OGC-WCS service with for example a huge DEM/height model.

And after that QGIS is requesting several times for one extent some
portion of the data (while this server is very slow on this)
I was thinking about a possibility to NOT do this everytime (or at least
give an option to do it ONLY on the real data available already by QGIS).

Does this fit your problem?


Richard Duivenvoorde

ps anybody willing to play with such a dem:



On 1/18/19 1:56 PM, Luigi Pirelli wrote:
> Hi devs
> I face a (IMHO) an API limitation that I'm not sure is a limitation of a
> feature :)
> I'm working adding SLD export for rasters as new feature and some
> stretching (QgsContrastEnhancement) should be mapped differently if the
> min/max values has been modified from the real min/max of the image.
> This can be simply asked to the raster with
> QgsRasterLayer.statistic(<band number>). The main problem I'm faced is
> that if statistic is not present it is ALWAYS calculated.
> This means that if we have big images or a remote one (e.g. COG) this
> would take long time!
> I do not analysed any raster provider, but I suppose that min/max values
> can be estimated asking to raster metadata.
> IMHO we can have an API like
> QgsRasterLayer.estimatedStatistic(<band number>)
> or
> QgsRasterLayer.statistic(<band number>, estimated=false)
> that can return metadata values if available.
> The proposal is valid if there is no a method to get estimated
> statistic, but I could be wrong and that's the reason of this post.
> Luigi Pirelli
> p.s. remember to come to 2019.qgis.es <http://2019.qgis.es> ;) we'll
> open inscription next monday!
> **************************************************************************************************
> * LinkedIn: https://www.linkedin.com/in/luigipirelli
> * Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
> * GitHub: https://github.com/luipir
> * Mastering QGIS 2nd Edition:
> *
> https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition
> * Hire me: http://goo.gl/BYRQKg
> **************************************************************************************************
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

More information about the QGIS-Developer mailing list