Aggregate Polygons (Cartography)
Combines polygons within a specified distance to each other into new polygons.
This tool is intended for moderate scale reduction and aggregation, when input features can no longer be represented individually due to the limited map space or the required data resolution. Aggregation will only happen where two polygon boundaries are within the specified aggregation distance to each other. There will be no self-aggregation, meaning no aggregation within an input polygon feature itself along its boundary, and no aggregation between any parts of a multipart polygon feature.
Using the orthogonal option will construct orthogonally shaped output features. This option is best suited for use with input features that have predominantly orthogonal edges. In some cases, less aggregation will occur in order to accommodate this. For example, two square buildings situated diagonally apart within the aggregation distance may not be aggregated because there is no clear connection that can be made while preserving orthogonality. The non-orthogonal option will produce more organically shaped results.
The output feature class will not contain any geographic attributes from the input features. A one-to-many relationship table with the name of output_feature_class_Tbl will be created that links the aggregated polygons to their source polygons. This table will contain two fields, OUTPUT_FID and INPUT_FID, storing the aggregated feature IDs and their source feature IDs, respectively. The link can become incorrect when any of the input or output features are modified. With this link, you can derive necessary attributes for the output features from their source features using appropriate geoprocessing tools.
If the input features contain Z values, the Z values can be preserved if specified in the environment settings. Where the output vertices are not changed, the input Z values will be carried over to the output vertices; otherwise, a Z value will be derived for new vertices, either from existing Z values or through interpolation.
The polygon features to be aggregated.
The output feature class to be created.
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.
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.
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.
Specifies the characteristic of the output features when constructing the aggregated boundaries.
The following Python window script demonstrates how to use the AggregatePolygons tool in immediate mode.
import arcpy from arcpy import env import arcpy.cartography as CA env.workspace = "C:/data" CA.AggregatePolygons("buildings.shp", "C:/output/output.gdb/aggregated_buildings", 10)
The following stand-alone script demonstrates how to use the AggregatePolygons function.
# Name: AggregatePolygons_Example2.py # Description: Aggregate grass features and then transfer attributes # Import system modules import arcpy from arcpy import env import arcpy.cartography as CA import arcpy.management 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") # 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")