Aller au contenu principal

Extract Raster by Attributes

Overview

Extract Raster by Attributes filters and extracts cells from an input raster according to a user-defined logical expression. Each raster cell has a value, and the tool evaluates the condition cell by cell. Cells that match the condition can keep their original values or receive a specified value; cells that do not match are written as NoData or ignored, producing an output raster that contains only the target cells.

Use Cases

  • Remote sensing and land-use analysis: extract cells whose land-use class value represents cropland for area statistics or temporal change analysis.
  • Environmental quality assessment: extract areas where AQI or PM2.5 raster values are greater than 75 μg/m³ to locate pollution hotspots.
  • Vegetation and ecological monitoring: extract high-vegetation-cover areas, such as NDVI > 0.4, for ecological assessment.
  • Hydrology and meteorology analysis: extract rainfall areas greater than or equal to 100 mm for flood-risk analysis.
  • Geohazard risk assessment: extract areas where slope values are greater than 30 degrees for landslide susceptibility analysis.

Parameters

ParameterDescriptionNotes
Input raster fileSource raster whose cells will be filtered by the logical conditionSupports single-band or multiband rasters, including common formats such as .tif (GeoTIFF), .img (ERDAS IMG), and .asc (ASCII Raster). The input should have valid spatial reference information.
Extraction methodLogical operator for the cell value, used to define the filtering conditionCommon operators include greater than, less than, equal to, greater than or equal to, less than or equal to, and not equal to. Range conditions, such as 10 <= value <= 50, or logical combinations, such as value > 30 AND value < 80, may also be supported.
Extraction valueNumeric threshold used with the extraction method to define the value rangeThe value type should be consistent with the cell value type of the input raster.
Output pathTarget directory for the result raster fileEnsure that the directory exists and is writable. Avoid Chinese characters, spaces, and special symbols in the path for better cross-platform compatibility.
Output file nameFull result raster file name, including extensionThe extension determines the output format, such as .tif for GeoTIFF or .img for ERDAS IMG. Avoid spaces and special characters in the file name.

Steps

  1. Start the tool

    Open Spatial Analysis Tools > Extraction Analysis, then double-click Extract Raster by Attributes to start the tool pane.

  2. Select the input raster file

    • Input raster file: enter dem.tif.
  3. Configure the extraction condition

    • Extraction method: select Greater than.
    • Extraction value: enter 1000.
  4. Specify the output location

    • Output path: set the output to User Space/Toolbox/Spatial Analysis Tools.
    • Output file name: enter attribute.tif.
  5. Run the tool

    • Click Run at the bottom of the pane and wait until the task list reports that the tool has succeeded.

Notes

  • Logical expression check: validate expression syntax before running to avoid runtime errors. For multiband operations, make sure the band count matches the fields referenced in the expression.
  • Data type: the input raster can be integer or floating point. Pay attention to type conversion during comparison.
  • NoData and boundary values: NoData cells do not participate in calculation by default and remain NoData in the result. Convert NoData to valid values first if they need to participate in logical operations.
  • Output format: GeoTIFF (.tif) is recommended. Compression such as LZW or DEFLATE can reduce storage size.