Friday, 3 March 2017

pyqgis - Changing pixel values of raster data from QGIS python plugin


I have been trying my hand at a QGIS plugin. The plug in reads raster layer data into an array, pipes the data to a C++ program, does processing over there, and pipes my results back. After a couple of weeks of fiddling with it, all that works fine.


I would now like to take these results and use them to change the pixel values on the processed raster layers. I have found numerous questions on the site that tell me how to read the raster data from the data provider, but I have not found one that explains to me how I can change the pixel values for the raster layer using Python w/ QGIS.


As a dummy example lets say I have an image of a forest and I want to change all the pixels in a band raster layer with values > 100 to -1 (for example).


How would I do that?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...