# Calculator function

Map Algebra is a way to perform spatial analysis by creating expressions in an algebraic language. With the Calculator function, you can create and run expressions and incorporate those into function chains.

There are four inputs to the Calculator function:

• Raster Variables
• Expression
• Extent type
• Cell size type

The calculator function requires single-band inputs. If you need to perform expressions on bands in a multispectral image as part of a function chain, you can use the Extract Bands Function before the Calculator function. This function provides access to all existing math functions so you can make calls to them when building your expressions. To assist you, autocomplete is built in to provide access to the operators as well as the math functions.

The operators available to you are listed in the table below.

OperationSymbol

+

Division

/

Modulo

%

Multiplication

*

Power

**

Subtraction

-

OperationSymbol

Boolean And

&&

Boolean Or

||

#### Relational Operations

OperationSymbol

Equal to

==

Greater than

>

Greater than or Equal to

>=

Less than

<

Less than or Equal to

<=

Not Equal to

!=

OperationSymbol

Minimum of two rasters on a per-pixel basis

min(a,b)

Maximum of two rasters on a per-pixel basis

max(a,b)

## Examples of expressions

### Simple Conditional Statement

Find elevation values above 4,000 feet. Give these areas a value of 1 and all other areas a value of 0. ### Nested Conditional Statement

Find areas where slope is below 10 degrees and NDVI is above 0.5. Give these areas a value of 1. For all other areas, assign a value of 2 if slope is above 10 degrees and elevation is over 2,500 feet. All other areas are assigned a value of 3. #### Related topics

##### In this topic
1. Examples of expressions