Simplify Line (Cartography)
Summary
Simplifies lines by removing extraneous bends while preserving essential shape.
Illustration
Usage
There are two simplification methods:
- The point remove method is the faster of the two processes. It removes redundant vertices. Use this method for data compression or more coarser simplification, especially when the data is well-known. The angularity (sharp corners) of the resulting line will increase significantly as the tolerance increases, so the line may become less aesthetically pleasing.
- The bend simplify method is slower but typically produces results that are more faithful to the original and more aesthetically pleasing. It operates by eliminating insignificant bends along lines. Use this method for less, more refined simplification.
The simplification tolerance value determines the degree of simplification. Set the tolerance equal to or greater than the minimum allowable spacing between graphic elements. Using the same tolerance, point remove produces rougher and more simplified results than bend simplify.
-
The tool produces two output feature classes: a line feature class to store the simplified lines and a point feature class to store points that represent any lines that were collapsed to zero-length. The point output name and location is automatically derived from the output line name with a _Pnt suffix. The line output will contain all the input fields; the point output will not contain any of the input fields.
-
There are options for handling topological errors in the output:
- The Check for topological errors parameter identifies topological errors introduced by the simplification process. When the option is checked, the Resolve topological errors parameter will also be enabled. Processing is faster without a topology check, but you should use this parameter if you do not have confidence in the topological accuracy of the data.
- The line output will contain two new fields to indicate whether or not a feature has a topological error. InLine_FID and SimLnFlag contain the input feature IDs and topological errors, respectively. A value of 1 indicates an error was introduced, while 0 (zero) indicates that no errors were introduced.
- The flag values will remain in place after a topological error has been resolved. Use the SimLnFlag field to examine features that have topological errors.
-
The Check for topological errors and Resolve topological errors parameters cannot be used within an edit session. Disable the Check for topological errors parameter in order to run the tool within an edit session.
Syntax
Parameter | Explanation | Data 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.
| 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.
| 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).
| 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.
| 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.
| Boolean |
Code Sample
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)
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)