An overview of the map algebra operators

Available with Spatial Analyst license.

Available with Image Analyst license.

Map algebra supports a series of operators. The operators can be grouped into Arithmetic, Bitwise, Boolean, and Relational categories. The map algebra operators are available with the ArcGIS Spatial Analyst extension license and the ArcGIS Image Analyst extension license.

The operators are overloaded since they exist in the Spatial Analyst ArcPy module, the Image Analyst ArcPy module, and as standard operators in 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"). The available operators are listed in the table below.

For operators that accept two inputs, if both inputs are scalars, the Python operator will be used to work on scalars. If one or both of the inputs are rasters (identified by casting with the Raster class), the ArcPy 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, the Python operator is used; if a raster is input, the ArcPy operator is used.

Operators by category

The available operators are listed by category in the following table:

Map algebra operatorDescriptionSpatial Analyst geoprocessing tool

Arithmetic

+ (Addition)

Adds (sums) the values of two inputs.

Plus

+ (Unary Plus)

Multiplies each value of the input by 1.

N/A

- (Subtract)

Subtracts the values of one input from another.

Minus

- (Negate)

Negates (changes the sign) of values in the input by multiplying them by -1.

Negate

* (Multiplication)

Multiplies the values of two inputs.

Times

** (Power)

Raises the values of one input to the power of the values in the other input.

Power

/ (Division)

Divides the values of two inputs.

Divide

// (Integer Division)

Performs an integer divide of two inputs.

N/A

% (Modulo)

Calculates the remainder (modulo) of the first input when divided by the second.

Mod

Bitwise

<< (Bitwise Left Shift)

Performs a Bitwise Left Shift operation on the binary values of two inputs.

Bitwise Left Shift

>> (Bitwise Right Shift)

Performs a Bitwise Right Shift operation on the binary values of two inputs.

Bitwise Right Shift

Boolean

& (Boolean And)

Performs a Boolean And operation on the inputs.

Boolean And

~ (Boolean Not)

Performs a Boolean-complement (Not) operation on the input.

Boolean Not

| (Boolean Or)

Performs a Boolean Or operation on the inputs.

Boolean Or

^ (Boolean XOr)

Performs a Boolean Exclusive Or operation on the inputs.

Boolean XOr

Relational

== (Equal To)

Performs a relational equal-to operation on the inputs.

Equal To

> (Greater Than)

Performs a relational greater-than operation on the inputs.

Greater Than

>= (Greater Than Equal To)

Performs a relational greater-than-equal operation on the inputs.

Greater Than Equal

< (Less Than)

Performs a relational less-than operation on the inputs.

Less Than

<= (Less Than Equal To)

Performs a relational less-than-equal operation on the inputs.

Less Than Equal

!= (Not Equal)

Performs a relational not-equal operation on the inputs.

Not Equal

Related topics


In this topic
  1. Operators by category