Tabulate Area (Spatial Analyst)

Summary

Calculates cross-tabulated areas between two datasets and outputs a table.

Illustration

Tabulate Area illustration
TabulateArea(ZoneRas, "VALUE", ClassRas, "VALUE", Tabarea1.dbf, 1)

Usage

  • A zone is defined as all areas in the input that have the same value. The areas do not have to be contiguous. Both rasters and features can be used for the zone input.

  • If either of the inputs is a raster, it must have an integer data type.

  • If either of the input datasets is a feature class, it is converted internally to a raster before the analysis is performed, using the Cell Size and the cell alignment of the other input raster.

  • If both the inputs are rasters and their cells are not aligned, the inputs will be resampled during the analysis. If the environment Snap Raster hasn't been explicitly specified, the cells are aligned internally using the Input raster or feature class data (in_class_data in Python). If both the rasters are of the same cell size and the cells are aligned, there will be no resampling.

  • If both of the input datasets are feature class, they are converted internally to a raster before the analysis is performed using the Processing Cell Size (processing_cell_size in Python) or from the raster analysis environment, if specified.

  • If the Input raster or feature zone data (in_zone_data in Python) is a feature, for any of the zone features that do not overlap any cell centers of the class raster, those zones will not get converted to the internal zone raster. As a result, those zones will not be represented in the output. You can manage this by determining an appropriate value for the Cell Size environment that will preserve the desired level of detail of the feature zones, and specify it in the analysis environment.

  • If the inputs have overlapping features, the zonal analysis will be performed for each individual feature.

  • If point or line data is used as the input feature class, the area intersected by those features will be reported.

  • When specifying the input zone or class data, the default field will be the first available integer or text field. If no other valid fields exist, the ObjectID field (for example, OID or FID) will be the default.

  • The Processing Cell Size parameter can be defined by a numeric value or obtained from an existing raster dataset. If the cell size hasn’t been explicitly specified as the parameter value, it is derived from the Cell Size environment if it has been specified. If the parameter cell size or the environment cell size has not been specified, the default output cell size is determined based on the type of input dataset as follows:

    • If the input dataset is a raster, the cell size of the dataset is used.
    • If the input dataset is a feature and the Snap Raster environment has been set, the cell size of the snap raster is used. If no snap raster is set, the cell size is calculated from the shorter of the width or height of the extent divided by 250 in which the extent is in the output coordinate system specified in the environment.
  • If the cell size is specified using a numeric value, the tool will use it directly for the output raster.

    If the cell size is specified using a raster dataset, the parameter will show the path of the raster dataset instead of the cell size value. The cell size of that raster dataset will be used directly in the analysis, provided the spatial reference of the dataset is the same as the output spatial reference. If the spatial reference of the dataset is different than the output spatial reference, it will be projected based on the specified Cell Size Projection Method value.

  • The Classes as rows in output table parameter (classes_as_rows in Python) allows you to select the type of output table schema. Check this parameter (CLASSES_AS_ROWS in Python) to represent the classes rows or uncheck it (CLASSES_AS_FIELDS in Python) to represent the classes as fields .

    When classes are represented in rows, the table output can be related and queried to extract area information by zone or class rasters.

  • The output of this tool is a table.

    In this table, when the Classes as rows in output table parameter is unchecked (CLASSES_AS_FIELDS in Python), the following is true:

    • There will be a record for each unique value of the zone dataset.
    • There will be a field for each unique value of the class dataset.
    • Each record will store the area of each class within each zone.

    When the Classes as rows in output table parameter is checked (CLASSES_AS_ROWS in Python), the following is true:

    • There will be a record for each unique value of the zone dataset that has an unique value of the class dataset.
    • There will be individual fields that identify the zone field, the class field, the count, and the area of each class within each zone.

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

Parameters

LabelExplanationData Type
Input raster or feature zone data

The dataset that defines the zones.

The zones can be defined by an integer raster or a feature layer.

Raster Layer; Feature Layer
Zone field

The field that contains the values that define each zone.

It can be an integer or a string field of the zone dataset.

Field
Input raster or feature class data

The dataset that defines the classes that will have their area summarized within each zone.

The class input can be an integer raster layer or a feature layer.

Raster Layer; Feature Layer
Class field

The field that holds the class values.

It can be an integer or a string field of the input class data.

Field
Output table
(Optional)

The output table that will contain the summary of the area of each class in each zone.

The format of the table is determined by the output location and path. By default, the output will be a geodatabase table if in a geodatabase workspace, and a dBASE table if in a file workspace.

Table
Processing cell size
(Optional)

The cell size of the output raster that will be created.

This parameter can be defined by a numeric value or obtained from an existing raster dataset. If the cell size hasn't been explicitly specified as the parameter value, the environment cell size value will be used if specified; otherwise, additional rules will be used to calculate it from the other inputs. See the usage section for more detail.

Analysis Cell Size
Classes as rows in output table
(Optional)

Specifies how the values from the input class raster will be represented in the output table.

  • Unchecked—Classes will be represented as fields. This is the default.
  • Checked—Classes will be represented as rows.
Boolean

TabulateArea(in_zone_data, zone_field, in_class_data, class_field, {out_table}, {processing_cell_size}, {classes_as_rows})
NameExplanationData Type
in_zone_data

The dataset that defines the zones.

The zones can be defined by an integer raster or a feature layer.

Raster Layer; Feature Layer
zone_field

The field that contains the values that define each zone.

It can be an integer or a string field of the zone dataset.

Field
in_class_data

The dataset that defines the classes that will have their area summarized within each zone.

The class input can be an integer raster layer or a feature layer.

Raster Layer; Feature Layer
class_field

The field that holds the class values.

It can be an integer or a string field of the input class data.

Field
out_table
(Optional)

The output table that will contain the summary of the area of each class in each zone.

The format of the table is determined by the output location and path. By default, the output will be a geodatabase table if in a geodatabase workspace, and a dBASE table if in a file workspace.

Table
processing_cell_size
(Optional)

The cell size of the output raster that will be created.

This parameter can be defined by a numeric value or obtained from an existing raster dataset. If the cell size hasn't been explicitly specified as the parameter value, the environment cell size value will be used if specified; otherwise, additional rules will be used to calculate it from the other inputs. See the usage section for more detail.

Analysis Cell Size
classes_as_rows
(Optional)

Specifies how the values from the input class raster will be represented in the output table.

  • CLASSES_AS_FIELDSClasses will be represented as fields. This is the default.
  • CLASSES_AS_ROWSClasses will be represented as rows.
Boolean

Code sample

TabulateArea example 1 (Python window)

This example returns a table with the area of each class value that is contained within each zone.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
TabulateArea("zonedata.shp", "IDStr", "valueraster", "VALUE",
             "C:/sapyexamples/output/areatable.dbf", 2)
TabulateArea example 2 (stand-alone script)

This example returns a table with the area of each class value that is contained within each zone.

# Name: TabulateArea_Ex_02.py
# Description: Calculates cross tabulated areas between two datasets.
# Requirements: Spatial Analyst Extension

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"
env.extent = "classgrid"
env.snapRaster = "classgrid"

# Set local variables
inZoneData = "zonedata.shp"
zoneField = "IDStr"
inClassData = "valueraster"
classField = "VALUE"
outTable = "C:/sapyexamples/output/areatable02.dbf"
processingCellSize = 2

# Execute TabulateArea
TabulateArea(inZoneData, zoneField, inClassData, classField, outTable,
             processingCellSize)

Related topics