I am looking for a tool from the GDAL that is able to reclassify a raster containing multiple discrete values. So far, I have found Reclassify rasters using GDAL and Python; however it seems that only single values can be handled here.
Is there something like a native tool from the suite?
Answer
gdal_calc
can be used for a reclassification of many classes.
For example, you can change values below (and equal) 12 to 10, values of 20, 30, 40, 50 stays the same, and values between above 50 and 62 are changed to 60:
python gdal_calc.py -A input.tif --outfile=output.file --calc="10*(A<=12)+20*(A==20)+30*(A==30)+40*(A==40)+50*(A==50)+60*((A>50)*(A<=62))" --NoDataValue=0
No comments:
Post a Comment