Zonal Geometry as Table (Spatial Analyst)

Summary

Calculates the geometry measures (area, perimeter, thickness, and the characteristics of an 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 rasters and features can be used for the zone input.

  • The Processing Cell Size 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, 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 in which 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 specified Cell Size Projection Method value.

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

  • If the Input Raster or Feature Zone Data value has overlapping polygons, the zonal analysis will not be performed for each individual polygon. Since the feature input is converted to a raster, each location can have only 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 Raster or Feature Zone Data value, the default zone 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.

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

Parameters

LabelExplanationData Type
Input raster or feature zone data

The dataset that defines the zones.

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

Raster Layer; Feature Layer
Zone field

The field that contains the values that define each zone.

It must be an integer field of the zone dataset.

Field
Output 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 provided, the output will be an INFO table. INFO tables are not supported as input in ArcGIS AllSource and cannot be displayed

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

Analysis Cell Size

ZonalGeometryAsTable(in_zone_data, zone_field, out_table, {processing_cell_size})
NameExplanationData Type
in_zone_data

The dataset that defines the zones.

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

Raster Layer; Feature Layer
zone_field

The field that contains 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 provided, the output will be an INFO table. INFO tables are not supported as input in ArcGIS AllSource and cannot be displayed

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

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)

Related topics