You can produce a classified raster output from the Calculator tool using a classified raster as input and applying the same expressions used in case of a continuous raster. For example, if you have an input classified raster with many classes, and one class is named "Lake", you can apply an expression and produce an output classified file that contains only the class "Lake".
Classification table strings may be included in expressions if enclosed in double quotes. For example, cond(Input_1="Lake", Input_1, null)
For example, consider the following classified grid with the classes shown below:
The following is the classification table representing each class in the input file:
To produce an output classified raster from the input that contains just the class "Lake", use the expression in the Expression Editor.
cond(Input_1 = Variable_1, Input_1, null)
Where:
- Input_1 = The source classified raster.
- Variable_1 = Hydrology / Lake class as seen from the table above.
The expression above will produce the following output:
Change a value in a classified raster to another value
In a classified raster, you can change all occurrences of one class to another class. For example, if you want to change all occurrences of the class "Perennial Snow or Ice/Glaciers" to "Tundra/Shrub and Brush Tundra", use the following expression:
If (Input_1="Perennial Snow or Ice/Glaciers") then "Tundra/Shrub and Brush Tundra" else Input_1 endif
Where Input_1 is the input classified raster containing both the classes used in the expression.
Create classified raster from continuous raster
If you want to create a classified raster from an elevation raster where only cells with elevation values less than 600 should be set to "True", then:
if (Input_1<600) then "True" else "False" endif
Where Input_1 is the input elevation file. The output will be a classified file with only two classes, True and False. Depending upon the expression, there may be different colors for True and False.
Input Raster |
Output Raster |
You can also view the colors of each class from the Color tool, as shown below: