

Variables representing dataset names or strings should be enclosed in both quotes and percent symbols ( "% %").įor example, inraster when selected from the variable list will become "%inraster%" in the expression.Long, double, or Boolean-type variables will be enclosed in percent symbols ( % %).


If you select a variable from the variable list, it will be automatically added to the expression at the current cursor location. The syntax of the expression determines how variables are to be specified.The Raster Calculator tool can be used in ModelBuilder, but keep the following points in mind: Operators and tools that support deferred evaluation are included on the raster calculator tool itself either as a button or in the list of tools provided. Only operators and tools that process on a per-cell basis can take advantage of this capability. Deferred evaluation is an optimization technique where individual components of an expression are intelligently processed so as to minimize the creation of intermediate datasets on disk. The performance of an operation may be enhanced by the deferred evaluation capabilities of Map Algebra. For more information, see Complex Statement Rules. To avoid this potential problem, use appropriate parentheses in the expression so that the execution order of the operators is explicitly defined. When multiple Relational and/or Boolean operators are used consecutively in a single expression, in some cases it may fail to execute. To change the order of execution, use parentheses. Therefore, when Boolean operators are used in the same expression as Relational operators, the Boolean operators will be executed first. You can use parentheses to control the execution order.īoolean ( ~, &, ^, |) operators have a higher precedence level than Relational (, >=, =, !=) operators. For more information on operator precedence, see operator precedence table. The operator with the highest precedence value will be executed first. When multiple operators are used in an expression, they are not necessarily executed in left-to-right order. To create a raster with cells of a constant value, specify the appropriate extent and cell size environment settings and enter the numerical value into the expression. When the tool is executed, the resulting raster output will be clipped based on the specified extent. You can easily clip a raster dataset by setting the extent environment and specifying the input raster name in the expression. You do not need to cast input data as a Raster object when using operators.You do not need to put the output raster name or the = sign in the expression because the output name is specified in the Output raster parameter.The tool supports the standard Map Algebra syntax that is used in Python scripting. If the capitalization is incorrect, the expression will be invalid and fail to execute because Python is case sensitive.Īn example of the general format of a Map Algebra expression using using geoprocessing tools is: When typing tool names, be sure to check the tool name syntax. Multiple geoprocessing tools and operations can be combined in a map algebra expression using standard Python syntax. The operators in the Raster Calculator tool dialog box are: Numbers and scalars can be directly entered into an expression. A list of commonly used conditional and mathematical tools is provided, allowing you to easily add them to the expression.įull paths to data or data existing in the specified current workspace environment setting can be entered in quotes ( ""). Numerical values and mathematical operators can be added to the expression by clicking the respective buttons in the tool dialog box. Use the Layers and variables list to select the datasets and variables to use in the expression. The Raster Calculator tool allows you to create and execute a Map Algebra expression that will output a raster. It is not intended for use in scripting and is not available in the ArcPy Spatial Analyst module. The Raster Calculator tool is intended for use in the application only as a GP tool dialog box or in ModelBuilder.
