I would like to reclass raster image with PyQGIS command from the Python Console. It runs without error but nothing is created. I have tried a lot of codes from here, but nothing is working.
from PyQt4.QtCore import QFileInfo import processing # Define input and output paths filePath = "/home/lukas/Desktop/Sentinel/flood.tif" output = "/home/lukas/Desktop/Sentinel/flood_reclass.tif" rules = "/home/lukas/Desktop/pyqgis/reclass.txt" # Get raster data fileInfo = QFileInfo(filePath) baseName = fileInfo.baseName() rlayer = QgsRasterLayer(filePath, baseName) # Define the minimum extent of the region extent = rlayer.extent() xmin = extent.xMinimum() xmax = extent.xMaximum() ymin = extent.yMinimum() ymax = extent.yMaximum() import processing processing.runalg("grass7:r.reclass", rlayer,None, rules, "%f,%f,%f,%f"% (xmin, xmax, ymin, ymax), 0.0, output)
Console show no error but there is no result. I have tried to run this in tool, with these layers and rules file and it was working. When I copy command from processing tools history - which worked in tool - it is not working in console.