Extract by Attributes (Spatial Analyst)

ArcGIS Pro 3.4 | | Help archive

Available with Spatial Analyst license.

Summary

Extracts the cells of a raster based on a logical query.

Illustration

Extract by Attributes illustration
OutRas = ExtractByAttributes(InRas1, "Value > 0")

Usage

  • Additional attributes from the input raster, if any, will be carried over as-is to the output raster attribute table. Depending on the property being recorded, some of the attribute values may need to be recalculated.

  • When a multiband raster is specified as the Input Raster (in_raster in Python) value, all bands will be used.

    To process a selection of bands from a multiband raster, first create a raster dataset composed of those particular bands using the Composite Bands tool. Then use the result as the Input Raster (in_raster in Python) value.

    The default output format is a geodatabase raster. If an Esri Grid stack is specified as the output format, the name of the stack cannot start with a number, use spaces, or be more than nine characters in length.

  • If the Where clause evaluates to true, the original input value is returned for the cell location. If it evaluates to false, the cell location is assigned NoData.

  • The Where clause uses an SQL query. See the following topics for more details on creating queries:

  • In order to use a {where_clause} in Python, it should be enclosed in quotes. For example, "Value > 5000".

    You can consult the help for more information on specifying a query in Python.

  • If an item other than Value of input raster is specified in the query, the original input value is returned for the cell location.

  • If the input raster is integer, the output raster will be integer. If the input is floating point, the output will be floating point.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

Parameters

LabelExplanationData Type
Input raster

The input raster from which cells will be extracted.

Raster Layer
Where clause

A logical expression that selects a subset of raster cells.

The Where clause follows the general form of an SQL expression. It can be entered directly, for example, VALUE > 100, if you click the Edit SQL mode button SQL Query. If in the Edit Clause Mode Edit Clause, you can begin constructing the expression by clicking on the Add Clause Mode button.

SQL Expression

Return Value

LabelExplanationData Type
Output raster

The output raster containing the cell values extracted from the input raster.

Raster

Licensing information

  • Basic: Requires Spatial Analyst
  • Standard: Requires Spatial Analyst
  • Advanced: Requires Spatial Analyst

Related topics