Available with Spatial Analyst license.
Summary
Calculates cross-tabulated areas between two datasets and outputs a table.
Illustration
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.
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})
Parameter | Explanation | Data 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:
| 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
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute TabulateArea
TabulateArea(inZoneData, zoneField, inClassData, classField, outTable,
processingCellSize)
Environments
Licensing Information
- ArcGIS for Desktop Basic: Requires Spatial Analyst
- ArcGIS for Desktop Standard: Requires Spatial Analyst
- ArcGIS for Desktop Advanced: Requires Spatial Analyst