ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Zonal Geometry

Available with Spatial Analyst license.

  • Summary
  • Illustration
  • Usage
  • Syntax
  • Code Sample
  • Environments
  • Licensing Information

Summary

Calculates the specified geometry measure (area, perimeter, thickness, or the characteristics of ellipse) for each zone in a dataset.

Learn more about how Zonal Geometry works

Illustration

Zonal Geometry illustration
OutRas = ZonalGeometry(InRas1,"VALUE","AREA")

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

  • The data type of the output raster for each of the geometry types will be floating point.

  • 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

ZonalGeometry (in_zone_data, zone_field, {geometry_type}, {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
geometry_type
(Optional)

Geometry type to be calculated.

  • AREA — The area for each zone.
  • PERIMETER — The perimeter for each zone.
  • THICKNESS — The deepest (or thickest) point within the zone from its surrounding cells.
  • CENTROID — Locates the centroids of each zone.
String
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

Return Value

NameExplanationData Type
out_raster

The output zonal geometry raster.

Raster

Code Sample

ZonalGeometry example 1 (Python window)

This example determines the area for each zone defined by the input polygon shape file.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outZonalGeometry = ZonalGeometry("zones.shp", "Classes", "AREA", 0.2)
outZonalGeometry.save("C:/sapyexamples/output/zonegeomout3")
ZonalGeometry example 2 (stand-alone script)

This example determines the area for each zone defined by the input polygon shape file.

# Name: ZonalGeometry_Ex_02.py
# Description:Calculates for each zone in a dataset the specified geometry 
#   measure (area, perimeter, thickness, or the characteristics 
#   of ellipse).
# 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"
cellSize = 0.2

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute ZonalStatistics
outZonalGeometry = ZonalGeometry(inZoneData, zoneField, "AREA", cellSize)  

# Save the output 
outZonalGeometry.save("C:/sapyexamples/output/zonegeomout2")

Environments

  • Auto Commit
  • Cell Size
  • Compression
  • Current Workspace
  • Extent
  • Geographic Transformations
  • Mask
  • Output CONFIG Keyword
  • Output Coordinate System
  • Raster Statistics
  • Scratch Workspace
  • Snap Raster
  • Tile Size

Licensing Information

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

Related Topics

  • An overview of the zonal tools
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal