# Calculator function

## Overview

Map Algebra is a way to perform spatial analysis by creating expressions using algebraic operators. With the Calculator function, you can create and run expressions and incorporate them into function chains.

The following operators are available with all license levels: plus, minus, times, divide, and power. All other operations require either the ArcGIS Image Analyst extension or the ArcGIS Spatial Analyst extension.

## Notes

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 available operators are listed in the table below.

OperationSymbol

Plus

+

Divide

/

Modulo

%

Times

*

Power

**

Minus

-

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

!=

#### Trigonometric Operations

OperationSymbol

ACos

ACos(a)

ACosH

ACosH(a)

ASin

ASin(a)

ASinH

ASinH(a)

ATan

ATan(a)

ATan2

ATan2(a)

ATanH

ATanH

Cos

Cos(a)

CosH

CosH(a)

Sin

Sin(a)

SinH

SinH(a)

Tan

Tan(a)

TanH

TanH(a)

OperationSymbol

Con

Con(a,b,c)

Is Null

IsNull(a)

Minimum of two rasters on a per-pixel basis

min(a,b)

Maximum of two rasters on a per-pixel basis

max(a,b)

Set Null

SetNull(a,b)

## Parameters

Parameter nameDescription
Raster Variables

The user-defined variable name and the input raster.

Expression

Build an algebraic expression to perform spatial analysis on the input raster.

Cellsize Type

The cell size used to create the output raster.

You can choose the output cell size from the following options in the drop down list:

• First Of—The cell size of the first raster variable.
• Min Of—The minimum cell size of the input rasters.
• Max Of—The maximum cell size of the input rasters.
• Mean Of—The average cell size of the input rasters.
• Last Of—The cell size of the last raster variable.

The default selection is Max Of.

Extent Type

The spatial extent used to create the output raster

You can choose the output extent from the following options in the drop down list:

• First of—The cell size of the first raster variable.
• Min Of—The minimum cell size of the input rasters.
• Max Of—The maximum cell size of the input rasters.
• Mean Of—The average cell size of the input rasters.
• Last Of—The cell size of the last raster variable.

The default selection is Intersection Of.

## 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.