Skip To Content

Tabulate Area

Available with Spatial Analyst license.

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 raster and feature can be used for the zone input.

  • If either of the inputs are rasters, it must be an integer 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 either of the input datasets is a feature class, it is converted internally to a raster before the analysis is performed.

  • 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 point or line data is used as the Input raster or feature class data (in_class_data in Python), the area intersected by those features will be reported.

  • If the inputs have overlapping polygons, the analysis will not be performed for each individual polygon for the overlapping area. Since the feature input is converted to a raster, each location can only have one value.

    An alternative method is to process the zonal operation iteratively for each of the polygon zones and collate the results.

  • 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 output of this tool a table.

    In this table:

    • 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.

  • The Processing cell size 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, where 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 selected Cell Size Projection Method.

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

Syntax

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

Dataset that defines the zones.

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

Raster Layer; Feature Layer
zone_field

Field that holds 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

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 the path is not in a geodatabase, the format is determined by the extension. If the extension is .dbf, it will be in dBASE format. If no extension is specified, the output will be an INFO table.

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 for more detail.

Analysis Cell Size

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)

Licensing information

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

Related topics