Skip to main content
6 events
when toggle format what by license comment
Apr 9, 2018 at 15:02 history edited ArMoraer CC BY-SA 3.0
x and y are actually inverted...
Jun 8, 2016 at 13:37 comment added Diego FG Unfortunately I got the same error with readBlock(). I finally managed to get the indices by creating a numpy array from the raster and then using the function np.where(raster==50). But thank you a lot @ArMoraer, a block seems a pretty straightforward solution, unfortunately not in the version I'm using
Jun 7, 2016 at 21:18 comment added ArMoraer From QGIS 1.8 API doc, it seems that you can use readBlock() instead. I can't really test it though, so I hope it will work...
Jun 7, 2016 at 14:58 comment added Diego FG Thank you a lot ArMoraer!! Instead "xSize" and "ySize" for me only lyr.width() and lyr.height() worked. But I got a problem in the 'block' line. I tried these: block = lyr.dataProvider().block(1, lyr.extent(), lyr.width(), lyr.height())--> But I get this error: "AttributeError: 'QgsRasterDataProvider' object has no attribute 'block'". Infortunately I'm working with the python console in a very old version of QGIS (Lisboa-1.8) because I'm at work and for specific reasons they don't want to move to a recent QGIS version. Can that be the reason why 'block' does not work for me?
Jun 7, 2016 at 13:54 history edited ArMoraer CC BY-SA 3.0
code corrected to better answer the question
Jun 7, 2016 at 13:48 history answered ArMoraer CC BY-SA 3.0