ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Executing tools in Map Algebra

Available with Spatial Analyst license.

  • Rules for executing tools

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.

  • Learn about working with operators

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")
      
    • Learn more about building complex statements

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

  • An overview of the rules for Map Algebra
  • Creating output
  • Building complex statements

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2020 Esri. | Privacy | Legal