Generalize (Editing)

Summary

Simplifies the input features using the Douglas-Peucker simplification algorithm with a specified maximum offset tolerance. The output features will contain a subset of the original input vertices.

Illustration

The line is simplified within the boundary of the maximum allowable offset
The line is simplified within the boundary of the maximum allowable offset

Usage

Syntax

Generalize_edit (in_features, {tolerance})
ParameterExplanationData Type
in_features

The polygon or line features to be generalized.

Feature Layer
tolerance
(Optional)

The tolerance sets the maximum allowable offset, which will determine the degree of simplification. This value limits the distance the output geometry can differ from the input geometry. You can specify a preferred unit of measurement. The default is the feature unit.

Linear unit

Code Sample

Generalize Example (Python Window)

The following Python window script demonstrates how to use the Generalize function in immediate mode:

import arcpy
from arcpy import env
env.workspace = "C:\data\data.gdb"
arcpy.Generalize_edit("zones", "10 Feet")
Generalize Example 2 (Stand-alone Script)

The stand-alone script below is an example of how to use the Generalize function in a workflow where features are first simplified and then buffered:

#Name: BufferZones.py
#Purpose: Simplify features using the Generalize tool and then Buffer them
#Author: ESRI

#Import script modules
import arcpy
from arcpy import env

try:
    #Set the workspace
    env.workspace = "C:/data/data.gdb"
    
    #Set local parameters
    inFeatures = "zones"
    gTolerance = "4 Feet"
    copFeatures = "zones_cp"
    bufDist = "50 Miles"
    bufOutput = "zones_buff"
    
    #Since Generalize permanently updates the input, first make a copy of the original FC
    arcpy.CopyFeatures_management (inFeatures, copFeatures)
    
    #Use the Generalize tool to simplify the Buffer input to shorten Buffer processing time
    arcpy.Generalize_edit(copFeatures, gTolerance)
    
    #Buffer the output
    arcpy.Buffer_analysis(copFeatures, bufOutput, bufDist, "", "", "", "")

except Exception, e:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    print "Line %i" % tb.tb_lineno
    print e.message    

Environments

Related Topics

Licensing Information

ArcView: No
ArcEditor: Yes
ArcInfo: Yes

4/27/2011