Erase (Analysis)
Summary
Creates a feature class by overlaying the Input Features with the polygons of the Erase Features. Only those portions of the input features falling outside the erase features outside boundaries are copied to the output feature class.
Illustration
Usage
-
Input Feature geometries coincident with Erase Feature geometries will be removed.
-
The Erase Features can be point, line, or polygon as long as the Input Feature is of the same or lesser order feature type. A polygon erase feature can be used to erase polygons, lines, or points from the input features; a line erase feature can be used to erase lines or points from the input features; a point erase feature can be used to erase points from the input features.
-
Attribute values from the input feature classes will be copied to the output feature class. However, if the input is a layer or layers created by the Make Feature Layer tool and a field's Use Ratio Policy is checked, then a ratio of the input attribute value is calculated for the output attribute value. When Use Ratio Policy is enabled, whenever a feature in an overlay operation is split, the attributes of the resulting features are a ratio of the attribute value of the input feature. The output value is based on the ratio in which the input feature geometry was divided. For example, If the input geometry was divided equally, each new feature's attribute value is assigned one-half of the value of the input feature's attribute value. Use Ratio Policy only applies to numeric field types.
Caution:Geoprocessing tools do not honor geodatabase feature class or table field split policies.
-
This tool will use a tiling process to handle very large datasets for better performance and scalability. For more details, see Geoprocessing with large datasets.
-
This tool may generate multipart features in the output even if all inputs were single part. If multipart features are not desired, use the Multipart to Singlepart tool on the output feature class.
Syntax
Parameter | Explanation | Data Type |
in_features |
The input feature class or layer. | Feature Layer |
erase_features |
The features to be used to erase coincident features in the input. | Feature Layer |
out_feature_class |
The feature class that will contain only those Input Features that are not coincident with the Erase Features. | Feature Class |
cluster_tolerance (Optional) |
The minimum distance separating all feature coordinates (nodes and vertices) as well as the distance a coordinate can move in X or Y (or both). | Linear unit |
Code Sample
The following Python window script demonstrates how to use the Erase function in immediate mode.
import arcpy
from arcpy import env
env.workspace = "C:/data/data/gdb"
arcpy.Erase_analysis(r'redlands.gdb\rdlswells\well',r'redlands.gdb\rdlsfloodzones\flood',r'redlands.gdb\wellsoutside_flood','#')
Find areas of suitable vegetation which exclude areas heavily impacted by major roads.
# Name: Erase.py
# Description: Find areas of suitable vegetation which exclude areas heavily impacted by major roads
# Author: ESRI
# import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "C:/data/Habitat_Analysis.gdb"
# Select suitable vegetation patches from all vegetation
veg = "vegtype"
suitableVeg = "C:/output/Output.gdb/suitable_vegetation"
whereClause = "HABITAT = 1"
arcpy.Select_analysis(veg, suitableVeg, whereClause)
# Buffer areas of impact around major roads
roads = "majorrds"
roadsBuffer = "C:/output/Output.gdb/buffer_output"
distanceField = "Distance"
dissolveField = "Distance"
arcpy.Buffer_analysis(roads, roadsBuffer, distanceField, "FULL", "ROUND", "LIST", dissolveField)
# Erase areas of impact around major roads from the suitable vegetation patches
eraseOutput = "C:/output/Output.gdb/suitable_vegetation_minus_roads"
xyTol = "1 Meters"
arcpy.Erase_analysis(suitableVeg, roadsBuffer, eraseOutput, xyTol)