I am having trouble sampling multiple pixels from a raster layer at oe time. If I want to sample pixel data from a layer at a particular coordinate I can write.
ident = layers[0].dataProvider().identify(QgsPoint(357109.988, 6255412.925),QgsRaster.IdentifyFormatValue)
where my magic numbers come from the x and y coordinates of my CRS for my particular use case; however, I want to sample a rectangular subregion of the layer. looking at the API documentation ( https://qgis.org/api/classQgsRasterDataProvider.html#a33c343510d534f82c820579b9093fea1 )it appears that I can do something like this:
ident = layers[0].dataProvider().identify(QgsPoint(357109.988, 6255412.925),QgsRaster.IdentifyFormatValue,QgsRectangle(0,0,2,2),2,2)
and that does return a value, but it only returns one value. further googling has only turned up the API documentation.
How do I retrieve a nxm array full of band values centered around (or starting from) a point in a raster layer?