Aggregate Polygons (Cartography)

License Level:BasicStandardAdvanced


Combines polygons within a specified distance of each other into new polygons.


Aggregate Polygons illustration



AggregatePolygons_cartography (in_features, out_feature_class, aggregation_distance, {minimum_area}, {minimum_hole_size}, {orthogonality_option}, {barrier_features}, {out_table})
ParameterExplanationData Type

The polygon features to be aggregated. If this is a layer referencing a representation and shape overrides are present on the input features, the overridden shapes, not the feature shapes, will be considered in aggregation processing.

Feature Layer

The output feature class to be created.

Feature Class

The distance to be satisfied between polygon boundaries for aggregation to happen. A distance must be specified, and it must be greater than zero. You can choose a preferred unit; the default is the feature unit.

Linear unit

The minimum area for an aggregated polygon to be retained. The default value is zero, that is, to keep all polygons. You can specify a preferred unit; the default is the feature unit.

Areal unit

The minimum size of a polygon hole to be retained. The default value is zero, that is, to keep all polygon holes. You can specify a preferred unit; the default is the feature unit.

Areal unit

Specifies the characteristic of the output features when constructing the aggregated boundaries.

  • NON_ORTHOGONALOrganically shaped output features will be created. This is suitable for natural features, such as vegetation or soil polygons. This is the default.
  • ORTHOGONALOrthogonally shaped output features will be created. This option is suitable for preserving the geometric characteristic of anthropogenic input features, such as building footprints.

The layers containing the line or polygon features that are aggregation barriers for input features. Features will not be aggregated across barrier features. Barrier features that are in geometric conflict with input features will be ignored.

Feature Layer

A one-to-many relationship table that links the aggregated polygons to their source polygon features. This table contains two fields, OUTPUT_FID and INPUT_FID, storing the aggregated feature IDs and their source feature IDs, respectively. Use this table to derive necessary attributes for the output features from their source features. The default name for this table is the name of the output feature class, appended with _tbl. The default path is the same as the output feature class. No table is created when this parameter is left blank.


Code Sample

AggregatePolygons tool example 1 (Python window)

The following Python window script demonstrates how to use the AggregatePolygons tool in immediate mode.

import arcpy
arcpy.env.cartographicPartitions = "C:/data/county.gdb/zipcodepoly"
buildings = "C:/data/county.gdb/bldgspoly"
roads = "C:/data/county.gdb/roadnetwork"
output = "C:/data/county.gdb/BldgAggBarrierPartition"
output_table = "C:/data/county.gdb/BldgAggBarrierPartition_Tbl"
arcpy.AggregatePolygons_cartography(buildings, output, "20 Meters", "5 SquareMeters", "0 SquareMeters", "ORTHOGONAL", roads, output_table)
AggregatePolygons tool example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the AggregatePolygons function.

# Name:
# Description: Aggregate grass features and then transfer attributes
# Author: ESRI
# Import system modules
import arcpy
from arcpy import env
import arcpy.cartography as CA
import as DM
import arcpy.analysis as AN
# Set environment settings
env.workspace = "C:/data/Portland.gdb/Vegetation"
# Set local variables
inGrassFeatures = "grass"
aggregatedFeatures = "C:/data/PortlandOutput.gdb/grassland"
aggregatedTable = "C:/data/PortlandOutput.gdb/grassland_Tbl"
frequencyTable = "C:/data/PortlandOutput.gdb/frequency_Tbl"

# Aggregate grass polygons.
CA.AggregatePolygons(inGrassFeatures, aggregatedFeatures, 50, 300, 300, "NON_ORTHOGONAL", "", aggregatedTable)
# Join the aggregatedTable with input and
# transfer the COUNT field to aggregatedTable.
DM.JoinField(aggregatedTable, "INPUT_FID", inGrassFeatures, "OBJECTID", "COUNT")
# Use Frequency on aggregatedTable and
# obtain sum for COUNT.
AN.Frequency(aggregatedTable, frequencyTable, "OUTPUT_FID", "COUNT")

# Join the aggregatedFeatures with frequencyTable
# and transfer the COUNT field to aggregatedFeatures.
DM.JoinField(aggregatedFeatures, "OBJECTID", frequencyTable, "OUTPUT_FID", "COUNT")


Related Topics

Licensing Information

ArcGIS for Desktop Basic: No
ArcGIS for Desktop Standard: No
ArcGIS for Desktop Advanced: Yes