2

I'm referring to QGIS Scripting problem updating contrast enhancements for raster layers using bandStatistics

The proposed scripts works fine; however I want to determine the statistics only on that part of the raster that is visible in the canvas. I therefore specified the extent in the bandStatistics command:

curExtent = iface.mapCanvas().extent()
myRasterBandStats = layer.dataProvider().bandStatistics(myBand, QgsRasterBandStats.Mean | QgsRasterBandStats.StdDev, curExtent)

Unfortunately this significantly slows down the bandStatistics command, which becomes much slower than when loading the min/max in the QGIS interface (properties of the layer => style)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.