I'm trying to make a decision tree in PyQGIS, but I can't find anything in the API that helps me to get started. I am going to work with raster data of surveys, radiometrics, magnetometrics, surface temperature and other derivatives of DEM, but I need to do it automatically to facilitate work with other areas. I need to get a raster image that directs me to the areas where the parameters assigned to each image are met, I do this process in ENVI but now I have to do it in QGIS.
GRASS is good option for decision tree in QGIS. To perform this we can use
r.mapcalculator (it provides a GUI frontend to r.mapcalc).
Ok, we can see that the decision tree uses several conditions to discover what pixels it should classify in a specific class. This conditions are translated to GRASS using this:
if(x,a,b) a if x not zero, b otherwise
So, to classify water (let’s say pixel value 0) to a class with value 5 and classify everything else to 255 we need to make this expression if(x,5,255), where x is the condition (e.g. image==0).