Simplify Line (Cartography)

License Level:BasicStandardAdvanced

Summary

Simplifies lines by removing extraneous bends while preserving essential shape.

Learn more about how Simplify Line works

Illustration

Simplify Line illustration

Usage

Syntax

SimplifyLine_cartography (in_features, out_feature_class, algorithm, tolerance, {error_resolving_option}, {collapsed_point_option}, {error_checking_option})
ParameterExplanationData Type
in_features

The line features to be simplified.

Feature Layer
out_feature_class

The output line feature class to be created.

Feature Class
algorithm

Specifies the line simplification algorithm.

  • POINT_REMOVERetains critical points that depict the essential shape of a line and removes all other points. This is the default.
  • BEND_SIMPLIFYRetains the critical bends in a line and removes extraneous bends.
String
tolerance

The tolerance that determines the degree of simplification. A tolerance must be specified, and it must be greater than zero. You can choose a preferred unit; the default is the feature unit.

  • For POINT_REMOVE algorithm, the tolerance you specify is the maximum allowable offset of each vertex from its original location. This value may be reduced locally in some areas when the option is used to resolve topological errors.
  • For BEND_SIMPLIFY algorithm, the tolerance you specify is the length of the reference bend baseline.
Linear unit
error_resolving_option
(Optional)

Specifies how the topological errors (possibly introduced in the process, including line crossing, line overlapping, and collapsed zero-length lines) will be handled. This parameter will be in effect when the error_checking_option is CHECK (the default).

  • FLAG_ERRORSSpecifies to flag topological errors, if any are found. This is the default.
  • RESOLVE_ERRORSSpecifies to resolve topological errors, if any are found.
Boolean
collapsed_point_option
(Optional)

Specifies whether to keep collapsed zero-length lines as points if any are found in the process. This option applies only when NO_CHECK is specified or when both FLAG_ERRORS and CHECK options are specified.

  • KEEP_COLLAPSED_POINTSSpecifies to keep the collapsed zero-length lines as points. The endpoints of the collapsed lines will be stored in a point feature class at the output feature class location, taking the name of the output feature class plus a suffix _Pnt. This is the default.
  • NO_KEEPSpecifies not to keep the collapsed zero-length lines as points even if they are found in the process; therefore, the point feature class will be empty.
Boolean
error_checking_option
(Optional)

Specifies how the topological errors (possibly introduced in the process, including line crossing, line overlapping, and collapsed zero-length lines) will be handled.

  • CHECKSpecifies to check for topological errors and enables the error_resolving_option parameter. This is the default.
  • NO_CHECKSpecifies not to check for topological errors and disables the error_resolving_option parameter.
Boolean

Code Sample

SimplifyLine example (Python window)

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

import arcpy
from arcpy import env
import arcpy.cartography as CA
env.workspace = "C:/data"
CA.SimplifyLine("roads.shp", 
                "C:/output/output.gdb/simplified_roads", 
                "POINT_REMOVE", 
                20)
SimplifyLine example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the SimplifyLine tool.

# Name: SimplifyLine_Example2.py
# Description: Simplify line features from two feature classes, rivers and coastlines,
# while maintaining their connections

 
# Import system modules
import arcpy
from arcpy import env
import arcpy.management as DM
import arcpy.cartography as CA
 
# Set environment settings
env.workspace = "C:/data/Portland.gdb/Hydrography"
 
# Set local variables
inRiverFeatures = "rivers"
inCoastlineFeatures = "coastlines"

mergedFeatures = "C:/data/PortlandOutput.gdb/merged_lines"
simplifiedFeatures = "C:/data/PortlandOutput.gdb/merged_lines_simplified"
tempLayer = "tempLyr"

outRiverFeatureClass = "C:/data/PortlandOutput.gdb/rivers_final"
outCoastlineFeatureClass = "C:/data/PortlandOutput.gdb/coastlines_final"

# Merge rivers and coastlines into one feature class, 
# assuming that they have a common f-code field 
# with value 40 for rivers and 80 for coastlines.
DM.Merge(inRiverFeatures, inCoastlineFeatures, mergedFeatures)

# Simplify all lines.
CA.SimplifyLine(mergedFeatures, 
                simplifiedFeatures, 
                "BEND_SIMPLIFY", 
                100, 
                "RESOLVE_ERRORS", 
                "KEEP_COLLAPSED_POINTS", 
                "CHECK")
 
# Select rivers and coastlines by their f-code values 
# and put them in separate feature classes.
DM.MakeFeatureLayer(simplifiedFeatures, tempLayer, "f-code = 40")
DM.CopyFeatures(tempLayer, outRiverFeatureClass)

DM.MakeFeatureLayer(simplifiedFeatures, tempLayer, "f-code = 80")
DM.CopyFeatures(tempLayer, outCoastlineFeatureClass)

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: No
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
3/3/2014