An overview of the Map Algebra Operators
Spatial Analyst Map Algebra supports a series of operators. The operators can be grouped into Arithmetic, Bitwise, Boolean, and Relational categories. The available operators and their categories are listed below.
The operators are overloaded since they exist in both Spatial Analyst and Python. To distinguish whether an input is a raster as opposed to a scalar variable, the input raster is cast using the Raster class: Raster("inRas").
In operators that accept two inputs, if both inputs are scalars, the Python operator will be used working on scalars. If one or both of the inputs are rasters (identified by casting with the Raster class), the Spatial Analyst operator is used and will work on each cell within the rasters. For those operators that accept a single input, if it is a scalar, then the Python operator is used; if a raster is input, the Spatial Analyst operator is used.
Map Algebra operator |
Description |
Spatial Analyst GP tool |
ArcGIS 9.x Map Algebra equivalent |
---|---|---|---|
Arithmetic | |||
+ (link) | Addition | + | |
+ (link) |
Unary Plus |
N/A |
N/A |
- (link) |
Subtraction |
- |
|
- (link) |
Unary Minus |
- |
|
* (link) |
Multiplication |
* |
|
** (link) |
Power |
N/A |
|
/ (link) |
Division |
/, div |
|
// (link) |
Integer Division |
N/A |
N/A |
% (link) |
Modulo |
Mod |
|
Bitwise | |||
<< (link) |
Bitwise Left Shift |
<< |
|
>> (link) |
Bitwise Right Shift |
>> |
|
Boolean | |||
& (link) |
Boolean And |
&, and |
|
~ (link) |
Boolean Complement |
^, not |
|
| (link) |
Boolean Or |
|, or |
|
^ (link) |
Boolean Exclusive Or |
!, xor |
|
Relational | |||
== (link) |
Equal To |
==, eq |
|
> (link) |
Greater Than |
>, gt |
|
>= (link) |
Greater Than or Equal To |
>=, ge |
|
< (link) |
Less Than |
<, lt |
|
<= (link) |
Less Than or Equal To |
<=, le |
|
!= (link) |
Not Equal To |
^=, <>, ne |
|