# 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

Choose which cell size to use in the output raster. If all the input cell sizes are the same, all the options will yield the same results.

• First Of—Use the first cell size of the input rasters.
• Min Of—Use the smallest cell size of all the input rasters.
• Max Of—Use the largest cell size of all the input rasters. This is the default.
• Mean Of—Use the mean cell size of all the input rasters.
• Last Of—Use the last cell size of the input rasters.

Extent Type

Choose which extent should be used in the output raster:

• First Of—Use the extent of the first input raster to determine the processing extent.

• Intersection Of—Use the extent of the overlapping pixels to determine the processing extent. This is the default.
• Union Of—Use the extent of all the rasters to determine the processing extent.
• Last Of—Use the extent of the last input raster to determine the processing extent.

## Examples of expressions

Expressions can be a simple one line of code, or it can be a several lines of code.

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