ArcGIS Desktop

  • Documentation
  • Support

  • 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

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 Spatial Analyst and Geostatistical Analyst extension tools that output a raster. It also applies to tools in the Raster Interpolation, Raster Math, Raster Reclass, and Raster Surface toolsets of the 3D Analyst extension 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 a 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 a Spatial Analyst 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

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
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2017 Esri. | Privacy | Legal