Skip To Content

Zonal Geometry as Table

Available with Spatial Analyst license.

Summary

Calculates the geometry measures (area, perimeter, thickness, and the characteristics of ellipse) for each zone in a dataset and reports the results as a table.

Learn more about how Zonal Geometry works

Illustration

Zonal Geometry as Table illustration
ZonalGeometryAsTable(InRas1,"VALUE",Out_Geom,1)
VALUE AREA  PERIMETER THICKNESS XCENTROID YCENTROID MAJORAXIS MINORAXIS ORIENTATION
0     5.0   14.0      0.5       2.300     2.100     2.338     0.681      60.714
1     5.0   14.0      0.5       1.900     2.100     2.668     0.596     126.061
2     3.0    8.0      0.5       3.167     2.167     1.286     0.743     135.000
4     2.0    6.0      0.5       0.500     1.000     1.128     0.564      90.000

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.

  • If the input zone data is a feature dataset, a cell size must be set either by the Processing cell size or in the Cell Size environment.

  • The calculations for each zone are recorded in the output table.

  • When specifying the input zone data, the default zone 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.

  • In the output table, the value field always precedes the fields containing the zonal output calculations. The value field contains the values of the zones defined by the zone dataset.

  • The values for the zonal calculations will be floating point.

  • All the results in the output table are presented in map units, except for the ORIENTATION item, which is in degrees in a range of 0 to 180. The orientation is defined as an angle between the x-axis and the major axis of the ellipse. The values of the orientation angle increase counterclockwise, starting at 0 in the east (horizontal, to the right) and going through 90 when the major axis is vertical.

  • If a particular zone consists of only one cell or if the zone is a single square block of cells, the orientation of the ellipse (which, in this case, is a circle) is set to 90 degrees.

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

Syntax

ZonalGeometryAsTable (in_zone_data, zone_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 must be an integer field of the zone dataset.

Field
out_table

Output table that will contain the summary of the values 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

ZonalGeometryAsTable example 1 (Python window)

This example determines the geometry measures for each zone defined by the input polygon shapefile.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outZonalGeometryAsTable = ZonalGeometryAsTable("zones.shp", "Classes", "zonalgeomout", 0.2)
ZonalGeometryAsTable example 2 (stand-alone script)

This example determines the geometry measures for each zone defined by the input polygon shapefile.

# Name: ZonalGeometryAsTable_Ex_02.py
# Description:Calculates for each zone in a dataset the specified geometry 
#   measure (area, perimeter,  thickness, or the characteristics 
#   of ellipse) and reports the results as a table.
# 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"

# Set local variables
inZoneData = "zones.shp"
zoneField = "Classes"
outTable = "zonalgeomout02.dbf"
processingCellSize = 0.2

# Execute ZonalGeometryAsTable
outZonalGeometryAsTable = ZonalGeometryAsTable(inZoneData, zoneField, "AREA", cellSize)

Licensing information

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

Related topics