ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

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
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Mask (Environment setting)

  • Illustration
  • Usage notes
  • Dialog syntax
  • Scripting syntax

Tools that honor the Mask environment will only consider those cells that fall within the analysis mask in the operation.

Illustration

Mask identifies the areas in the analysis extent to be included in the tool execution
Mask identifies the areas in the analysis extent to be included in the tool execution.

Usage notes

  • Setting an analysis mask means that processing will only occur on locations that fall within the mask, and all locations outside of it will be assigned to NoData in the output.
    Note:

    The Mask environment applies to ArcGIS Spatial Analyst extension and ArcGIS Geostatistical Analyst extension tools that output a raster. It also applies to tools in the ArcGIS 3D Analyst extension Raster Interpolation, Raster Math, Raster Reclass, and Raster Surface toolsets that output a raster.

  • The mask can be a raster or a feature dataset.
  • If the analysis mask is a raster, all cells that have a value will be considered to define the mask. Cells in a mask raster that are NoData will be considered to be outside the mask and will be NoData in the output.

    Tools such as Reclassify and Con can help create a raster analysis mask.

  • If the analysis mask is a feature dataset, it will internally be converted to a raster on execution. For this reason, you should take care to ensure that the Cell Size and Snap Raster are set appropriately for your analysis.

Dialog syntax

Mask—A dataset that defines which locations in the inputs will be considered in the execution of the tool. If the mask dataset is a raster, all cells with a value will compose the mask. Cells that are NoData in a raster mask will be NoData in the output. If a feature dataset is used as input for the mask, it will be converted internally to a raster on execution.

Scripting syntax

arcpy.env.mask = mask_source

ParameterExplanation

mask_source

The dataset that defines the mask.

It can be a raster or a feature dataset. If the dataset is a raster, cells that have a value will constitute the mask, and any cells that are NoData in the mask will be NoData in the output.

mask syntax

Script example

This example demonstrates how to set the Mask environment before executing an ArcGIS Spatial Analyst extension tool.

import arcpy

# Set environment
arcpy.env.workspace = "C:/workspace"

# Set Mask environment
arcpy.env.mask = "C:/data/maskpoly.shp"

# Set local variables
InZones = "C:/data/parcels.shp"
InZoneField = "Parcel_ID"
InValueRaster = "C:/data/Slope"

# Check out ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Process: Calculate the mean slope of each parcel area.
out = arcpy.sa.ZonalStatistics(InZones, InZoneField, InValueRaster, "MEAN","DATA")
out.save("mean_ParSlp")

Related Topics

  • An overview of geoprocessing environments
  • Environment levels and hierarchy
  • Setting geoprocessing environments
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

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

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal