I would like to create a plugin where I could use the values of a raster layer from the actual extent, to do some tricks.
For example if I have a raster which is a box [x,y,width,height] : [0,0,1000,1000], I zoom on it to see the AOI so my actual extent begin [50,50,100,100] (for example), how can I use it these values, without reloading the entire image ?
I would like to do really fast calcul (no reloading, no saving, just displaying with vector calcul => Instant on small area).
I can get the value of one pixel doing it like that :
layer = iface.mapCanvas().layers()[0]
extent = iface.mapCanvas().extent()
layer.dataProvider().identify(QgsPoint(extent.xMinimum(), extent.yMinimum()), QgsRaster.IdentifyFormatValue).results()[1]
Is that a way to us QgsRectangle on identify and not QgsPoint ? Because I would like to get the value of the extent rectangle and not from a point only, without doing a for loop of course to fill an array.