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

  • When the zone and class inputs are both rasters of the same resolution, they will be used directly.

    If the resolutions are different, an internal resampling is applied to make them match before the zonal operation is performed.

  • If the zone input is a raster dataset, it must have an attribute table. The attribute table is usually created automatically for integer rasters, but may not be under certain circumstances. You can use the Build Raster Attribute Table tool to create one.

  • If the zone input is feature dataset, a vector-to-raster conversion will be internally applied to it.

    To ensure that the results of the conversion will align properly with a class raster input, it is recommended that you check that the extent and snap raster are set appropriately in the environment settings and the raster settings.

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

  • If a reserved field (for example, OBJECTID, FID, or OID) is selected for the Zone field, then this may cause some ambiguity in the result. The result includes the particular reserved field name necessary for the particular output format type, as well as the Zone field specified. If the specified field has the same name as the reserved field for the particular output format, in the output, the name for the zone field will be altered in such a way that all field names in the result are unique.

    Note:

    To make a field of unique values that does not have a reserved name, use the Add Field and Calculate Field geoprocessing tools.

  • If the class input is feature dataset, a vector-to-raster conversion will also be internally applied to it. The conditions listed in the previous tip for a feature zone input also apply to a feature class input.

  • It is generally recommended to only use rasters as the zone and class inputs. If your inputs are feature, consider converting them to rasters first with the To Raster conversion tools. This offers you greater control over the vector-to-raster conversion, helping to ensure you consistently get the expected results.

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

  • The output of the Tabulate Area tool is 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.

  • See Working with Tabulate Area for explanations of certain issues that may be encountered with this tool and suggestions on how to work around them.

  • 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 processing cell size for the zonal operation.

This is the value in the environment if specifically set. If the environment is not set, the default for the cell size is determined by the type of the zone data as follows:

  • If the zone dataset is a raster, the cell size is the same as the zone raster.
  • If the zone dataset is a feature, the cell size is the shorter of the width or height of the extent of the zone feature dataset in the output spatial reference, divided by 250.

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

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

Related topics