The Raster Calculator tool allows you to create and run map algebra expressions in a tool.
Like other geoprocessing tools, the Raster Calculator tool can be used in ModelBuilder, allowing you to integrate the power of map algebra into your workflows.
Note:
The Raster Calculator tool is not intended to be used in scripting environments.
The Raster Calculator tool provides the following benefits:
- Implement single-line algebraic expressions.
- Support the use of variables in map algebra when in ModelBuilder.
- Apply Image Analyst operators on three or more inputs in a single expression.
- Use multiple Image Analyst tools in a single expression.
- Apply operators on three or more inputs in a single expression.
- Use multiple tools in a single expression.
The Raster Calculator tool is designed to run a single-line algebraic expression using multiple tools and operators. When multiple tools or operators are used in one expression, the performance of this equation will generally be faster than running each of the operators or tools individually.
Use the Raster Calculator tool
There are three main areas on the tool dialog box that are used to create a map algebra expression: Rasters, Tools, and the expression box.
Rasters
The input Rasters list identifies the input that can be used in the map algebra expression. The raster list contains the layers in the contents and datasets added with the Add raster button. When the tool is used in ModelBuilder, the raster list also contains Raster model variables.
Tools
The Tools list is a selection of tools that can be used in the map algebra expression. When you click a tool in the list, the tool name and open and close parentheses () are placed in the expression where the pointer is currently positioned. The remaining input required by the tool must then be entered. A tool can be placed anywhere in the expression, but it should be placed in a position that produces valid map algebra syntax.
The operators in the list allow you to enter mathematical (addition, division, and so on) and logical (greater than, equal to, and so on) operators in the expression. When you select these symbols, that operator is entered in the expression where the pointer is currently positioned.
Expression
The expression is the map algebra expression to be run. The expression must be entered with valid syntax. See the section below to learn more about the syntax rules for map algebra.
Map algebra language
Map algebra is a simple and powerful algebra with which you can run Image Analyst tools, operators, and functions to perform geographic analysis.
Map algebra is a simple and powerful algebra with which you can run all raster analysis tools, operators, and functions to perform geographic analysis.
The map algebra used in Raster Calculator has a syntax, or a set of rules, that must be followed to create a valid expression. If these rules are not adhered to, the expression may be invalid and will not run, or you may get results you did not expect.
Not only can you access map algebra from the Raster Calculator tool, but you can also access it in Python scripting using the Image Analyst ArcPy module. The map algebra syntax used in this tool is the same, with the following exceptions:
Not only can you access map algebra from the Raster Calculator tool, but you can also access it in Python scripting using the Spatial Analyst or Image Analyst ArcPy module. The map algebra syntax used in this tool is the same, with the following exceptions:
- You do not need to put the output raster name or the equal sign (=) in the expression, since the output name is specified in the Output raster parameter.
- You do not need to cast input data as a Raster object when using operators.