Tabulate Area (Spatial Analyst)
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 Build Raster Attribute Table 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.
If a reserved field (for example, OBECTID, 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.
Syntax
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. | 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
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)
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 # Author: ESRI # 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)