# Executing tools in Map Algebra

Map Algebra provides a rich suite of tools for performing comprehensive, raster-based spatial analysis and modeling. Map Algebra expressions can consist of a single tool or operator but can also consist of multiple tools and operators. Complex Map Algebra expressions may be made up of Spatial Analyst functionality but may also include tools from other toolboxes.

## Rules for executing tools

• A simple Map Algebra expression used to execute a single tool includes the tool name followed by the input dataset and the tool parameters within parentheses.
• Example using the Slope tool:
``outRas = Slope("elevation", "PERCENT_RISE", 3)``
• Example using the Zonal Statistics tool:
``````outRas = ZonalStatistics("inzoneraster", "Value",
"invalueraster", "MEAN")``````
• Tool names are case sensitive.
• Example with correct capitalization:
``````# The following tools have correct capitalization
#  and spelling, and are valid.
outRas = Slope("inraster")
outRas2 = FocalStatistics("inraster")``````
• Incorrect capitalization in the following example will cause an error condition, as both slope and Focalstatistics have invalid capitalization.
``````# Correct form is Slope, not slope
outRas = slope("inraster")

# Correct form is FocalStatistics, not Focalstatistics
outRas2 = Focalstatistics("inraster", neighborhood)``````
• Tools can be embedded one inside the other to create complex expressions. Complex expressions can consist of multiple Spatial Analyst tools but can also include tools from other toolboxes.
• Example using two Spatial Analyst tools:
``````# Complex expression using two Spatial Analyst tools
outRas = Slice(Slope("C:/Data/elevation"), 10)``````
• Example using a Spatial Analyst tool and a non-Spatial Analyst tool:
``````# The Result object output from the Buffer
#  tool is used as input into the Zonal Statistics tool
outRas = ZonalStatistics(arcpy.Buffer_analysis("C:/Data/schools.shp", "#", 500),
"OBJECTID", "C:/Data/pop1990", "SUM")``````

##### Note:

As with all tools in the Python window, if you select the tool name in the autocompletion selection list, the autocompletion will correct the appropriate capitalization for the tool name.

#### Related topics

##### In this topic
1. Rules for executing tools