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 ;) 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@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to