Eliminate (Data Management)
Eliminates polygons by merging them with neighboring polygons that have the largest area or the longest shared border. Eliminate is often used to remove small sliver polygons that are the result of overlay operations, such as Intersect or Union.
Features to be eliminated are determined by a selection applied to a polygon layer. The selection must be determined in a previous step by using Select Layer by Attribute, using Select Layer by Location, or querying a map layer in ArcMap.
Only selected polygons will be merged with a neighboring unselected polygon (by dropping the shared border). A selected polygon will not be merged with a neighboring selected polygon.
The Input Layer must include a selection; otherwise, Eliminate will fail.
The Exclusion Expression and Exclusion Layer are not mutually exclusive and can be used together to give full control over what is eliminated.
The layer whose polygons will be merged into neighboring polygons.
The feature class to be created.
These options specify which method will be used for eliminating features.
An expression used to identify input features that should not be eliminated.
The syntax for the expression differs slightly depending on the data source. For example, if you're querying file or ArcSDE geodatabases, shapefiles, or coverages, enclose field names in double quotes:
If you're querying personal geodatabases, enclose fields in square brackets:
In Python, strings are enclosed in matching single or double quotes. To create a string that contains quotes (as is common with a WHERE clause in SQL expressions), you can escape the quotes (using a backslash) or triple quote the string. For example, if the intended WHERE clause is
"CITY_NAME" = 'Chicago'
you could enclose the entire string in double quotes, then escape the interior double quotes like this:
" \"CITY_NAME\" = 'Chicago' "
Or you could enclose the entire string in triple quotes without escaping:
""" "CITY_NAME" = 'Chicago' """
For more information on SQL syntax and how it differs between data sources, see the help topic SQL reference for query expressions used in ArcGIS.
An input polyline or polygon feature class or layer that defines polygon boundaries, or portions thereof, that should not be eliminated.
The following Python window script demonstrates how to use the Eliminate tool in immediate mode.
import arcpy arcpy.env.workspace = "C:/data/Portland.gdb/Census" arcpy.MakeFeatureLayer_management("blockgrp", "blocklayer") arcpy.SelectLayerByAttribute_management("blocklayer", "NEW_SELECTION", '"Area_Sq_Miles" < 0.15') arcpy.Eliminate_management("blocklayer", "C:/output/output.gdb/eliminate_output", "LENGTH", '"OBJECTID" = 9')
The following stand-alone script demonstrates how to use the Eliminate tool.
# Name: Eliminate_Example2.py # Description: Eliminate features based on a selection. # Import system modules import arcpy # Set environment settings arcpy.env.workspace = "C:/data/Portland.gdb/Census" # Set local variables inFeatures = "blockgrp" tempLayer = "blocklayer" expression = '"Area_Sq_Miles" < 0.15' outFeatureClass = "C:/output/output.gdb/eliminate_output" exclusionExpression = '"OBJECTID" = 9' # Execute MakeFeatureLayer arcpy.MakeFeatureLayer_management(inFeatures, tempLayer) # Execute SelectLayerByAttribute to define features to be eliminated arcpy.SelectLayerByAttribute_management(tempLayer, "NEW_SELECTION", expression) # Execute Eliminate arcpy.Eliminate_management(tempLayer, outFeatureClass, "LENGTH", exclusionExpression)