Does anyone know if in Raster Calculator it is possible to build more complex condition than with the Con tool?
I would like to create a new column in my attribute table and evaluate the values in this column based on few different columns, e.g:
if value in column A > 50 give me A, then
if value in column B > 50 give me B, then
if value in column C > 50 give me C, then
if value in column D > 50 give me D, else
give me E
Any idea how to do this as one statement in Raster Calculator? Thanks in advance for your answers.
Hello,
If you're working with a raster with an attribute table (and it sounds like you are), a better tool might be the Field Calculator, which can incorporate python scripts to process if/else statements. Here's some of the documentation on this:
Fundamentals of Field Calculations - http://desktop.arcgis.com/en/arcmap/latest/manage-data/tables/fundamentals-of-field-calculations.htm...
Calculate Field - http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/calculate-field.htm
I don't think there's a way to do this with the Con tool, but maybe others here will have other ideas!
Best,
Lauren
You may be better off using the Reclassify tool.
https://pro.arcgis.com/en/pro-app/tool-reference/spatial-analyst/understanding-reclassification.htm
Reclassify won't work for this as it reclassifies the data in a single value field.
I agree with Lauren that working with Calculate Field in the raster table may be (much) more efficient, but I'm wondering how you got such a "fat" raster table. If the fat table was output from the Combine tool, you may want to skip the Combine tool and do this instead using the five input rasters:
Con("RasterA" > 50, "RasterA",
Con("RasterB" > 50, "RasterB",
Con("RasterC" > 50, "RasterC",
Con("RasterD" > 50, "RasterD",
"RasterE"))))