com.esri.arcgis.geoprocessing.tools.cartographytools
Class SimplifyLine
java.lang.Object
com.esri.arcgis.geoprocessing.AbstractGPTool
com.esri.arcgis.geoprocessing.tools.cartographytools.SimplifyLine
- All Implemented Interfaces:
- GPTool
public class SimplifyLine
- extends AbstractGPTool
Simplifies a line by removing small fluctuations or extraneous bends from it while preserving its essential shape.
The Simplify Line tool is contained in the Cartography Tools tool box.
Learn more about how Simplify Line works
Illustration:
Usage tips:
- The tool will produce two output feature classes, a line feature class and a point feature class. The line output will store all the simplified lines; and the point output will store points, if any, representing closed lines that are collapsed to zero-length as the result of simplification and cannot be written to the line output. Once the line output is specified, the point output will be automatically derived taking the same output location and the line output name plus a suffix, _Pnt.
- The line output will carry all the input fields. The point output will not.
- Significant differences between the two algorithms:
- POINT_REMOVE is a fast, simple algorithm that reduces a line quite effectively by removing redundant points, such as overdigitized vertices; however, the angularity of the resulting line will increase significantly as the tolerance increases so the line may become aesthetically unpleasing. Use POINT_REMOVE for data compression or a relatively low degree of simplification.
- BEND_SIMPLIFY applies advanced techniques to detect bends along a line, analyze their characteristics, and eliminate insignificant ones. It takes longer to process than POINT_REMOVE, but the resulting line is more faithful to the original and shows better aesthetic quality.
- Handling topological errors - three levels of processes controled by the combinations of the two parameters or the two checkbox options as described below:
- NO_CHECK (or having the checkbox for "Check for topological errors" unchecked): Both algorithms may introduce topological errors to the simplified results. If you are not concerned about the topological errors or if you know your data has little chance to result in topological errors, then use this option.
- FLAG_ERRORS option along with the CHECK option (or having the checkbox for "Resolve topological errors" unchecked and the checkbox for "Check for topological errors" checked): This combination of options detects topological errors possibly introduced by simplification. The line output will contain two new fields, InLine_FID and SimLnFlag. The InLine_FID field carries the feature IDs of the input lines; the SimLnFlag flags lines with a value of 1 indicating topological errors or a value of 0 indicating no errors.
- RESOLVE_ERRORS along with the CHECK option (or having the checkbox for "Resolve topological errors" checked and the checkbox for "Check for topological errors" checked): Use this combination of options if the input lines are congested in some areas, such as narrow, double-line rivers, winding roads, and so on, and you want to avoid topological errors in the result of simplification. The processing time will be longer than the above options, but you will receive a "clean" output with information about the simplified lines. The tolerance you specified may be good for majority lines but not for the ones in the congested areas. When a topological error is detected after the first round of simplification, the involved line segments (not the entire lines) will be located, and a reduced tolerance, 50 percent of that previously used, will be applied to re-simplify these segments. This iteration will repeat as many times as needed until no more topological errors are found. The line output feature class will contain the same number of lines as in the input, and it will have two new fields, MaxSimpTol and MinSimpTol, which store the maximum and minimum tolerances actually used in simplifying each line through the iterations. If no errors are introduced, the values of MaxSimpTol and MinSimpTol will be the same as the specified simplification tolerance.
- For NO_CHECK and FLAG_ERRORS options, invalid (self-intersecting) geometry may be created during the simplification process and will be repaired. For example, if a line crosses itself, the line will be repaired to become a multiple-part line such that no part crosses any other part, although the line will still look self-crossing.
- The FLAG_ERRORS and RESOLVE_ERRORS options of this tool are not supported in an edit session.
- The "Keep collapsed points" checkbox or the collapsed_point parameter only applies to the NO_CHECK and FLAG_ERRORS options for handling topological errors.
- With NO_CHECK option, if this checkbox is checked or if KEEP_COLLAPSED_POINT is specified, any collapsed points will be stored in the point output.
- With FLAG_ERRORS option, if this checkbox is checked or if KEEP_COLLAPSED_POINT is specified, the point output will contain a new field InLine_FID to link the collapsed points to their input lines.
- If an input line contains multiparts and one of the parts becomes a collapsed point, the point representing that part will also be included in the point output.
- The point output will be empty in the following cases:
- The "Keep collapsed points" checkbox is unchecked on the tool dialog or the NO_KEEP option is specified.
- The "Keep collapsed points" checkbox is checked on the tool dialog or the KEEP_COLLAPSED_POINT option is specified, but no lines are collapsed to points during simplification.
- RESOLVE_ERRORS is specified for handling topological errors; therefore, no lines will be collapsed (any collapsed lines will be restored).
- Learn more about spatial reference and geoprocessing
- The following environment settings affect this tool: XY tolerance, Extent, M domain, Coordinate system, Output has M values, Output has Z values, Default Z value, Output XY domain, workspace, and scratch workspace.
SimplifyLine
public SimplifyLine()
- Creates the Simplify Line tool with defaults.
Initializes the array of tool parameters with the default values specified when the tool was created.
SimplifyLine
public SimplifyLine(Object inFeatures,
Object outFeatureClass,
String algorithm,
Object tolerance)
- Creates the Simplify Line tool with the required parameters.
Initializes the array of tool parameters with the values as specified for the required parameters and with the default values for the other parameters.
- Parameters:
inFeatures
- Feature Layer, the line features to be simplified.outFeatureClass
- Feature Class, the output line feature class to be created.algorithm
- String, specifies the line simplification algorithm.- POINT_REMOVE—Keeps the so-called critical points that depict the essential shape of a line and removes all other points. This is the default.
- BEND_SIMPLIFY—Keeps the main shape of a line and removes extraneous bends.
tolerance
- Linear Unit, the tolerance that determines the degree of simplification. A tolerance must be specified, and it must be greater than zero. You can specify a preferred unit; the default is the feature unit.- For POINT_REMOVE algorithm, the tolerance you specify is the maximum allowable offset.
- For BEND_SIMPLIFY algorithm, the tolerance you specify is the length of the reference bend baseline.
getInFeatures
public Object getInFeatures()
- Returns the Input Features parameter of this tool .
This parameter is Feature Layer, the line features to be simplified.
This is a required parameter.
- Returns:
- the Input Features
setInFeatures
public void setInFeatures(Object inFeatures)
- Sets the Input Features parameter of this tool .
This parameter is Feature Layer, the line features to be simplified.
This is a required parameter.
- Parameters:
inFeatures
- Feature Layer, the line features to be simplified.
getOutFeatureClass
public Object getOutFeatureClass()
- Returns the Output Feature Class parameter of this tool .
This parameter is Feature Class, the output line feature class to be created.
This is a required parameter.
- Returns:
- the Output Feature Class
setOutFeatureClass
public void setOutFeatureClass(Object outFeatureClass)
- Sets the Output Feature Class parameter of this tool .
This parameter is Feature Class, the output line feature class to be created.
This is a required parameter.
- Parameters:
outFeatureClass
- Feature Class, the output line feature class to be created.
getAlgorithm
public String getAlgorithm()
- Returns the Simplification Algorithm parameter of this tool .
This parameter is String, specifies the line simplification algorithm.
This is a required parameter.
- Returns:
- the Simplification Algorithm
setAlgorithm
public void setAlgorithm(String algorithm)
- Sets the Simplification Algorithm parameter of this tool .
This parameter is String, specifies the line simplification algorithm.
This is a required parameter.
- Parameters:
algorithm
- String, specifies the line simplification algorithm.- POINT_REMOVE—Keeps the so-called critical points that depict the essential shape of a line and removes all other points. This is the default.
- BEND_SIMPLIFY—Keeps the main shape of a line and removes extraneous bends.
getTolerance
public Object getTolerance()
- Returns the Simplification Tolerance parameter of this tool .
This parameter is Linear Unit, the tolerance that determines the degree of simplification. A tolerance must be specified, and it must be greater than zero. You can specify a preferred unit; the default is the feature unit.
This is a required parameter.
- Returns:
- the Simplification Tolerance
setTolerance
public void setTolerance(Object tolerance)
- Sets the Simplification Tolerance parameter of this tool .
This parameter is Linear Unit, the tolerance that determines the degree of simplification. A tolerance must be specified, and it must be greater than zero. You can specify a preferred unit; the default is the feature unit.
This is a required parameter.
- Parameters:
tolerance
- Linear Unit, the tolerance that determines the degree of simplification. A tolerance must be specified, and it must be greater than zero. You can specify a preferred unit; the default is the feature unit.- For POINT_REMOVE algorithm, the tolerance you specify is the maximum allowable offset.
- For BEND_SIMPLIFY algorithm, the tolerance you specify is the length of the reference bend baseline.
getErrorResolvingOption
public String getErrorResolvingOption()
- Returns the Resolve topological errors parameter of this tool .
This parameter is String, 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).
This is an optional parameter.
- Returns:
- the Resolve topological errors
setErrorResolvingOption
public void setErrorResolvingOption(String errorResolvingOption)
- Sets the Resolve topological errors parameter of this tool .
This parameter is String, 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).
This is an optional parameter.
- Parameters:
errorResolvingOption
- String, 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_ERRORS—Specifies to flag topological errors, if any are found. This is the default.
- RESOLVE_ERRORS—Specifies to resolve topological errors, if any are found.
getCollapsedPointOption
public String getCollapsedPointOption()
- Returns the Keep collapsed points parameter of this tool .
This parameter is String, 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.
This is an optional parameter.
- Returns:
- the Keep collapsed points
setCollapsedPointOption
public void setCollapsedPointOption(String collapsedPointOption)
- Sets the Keep collapsed points parameter of this tool .
This parameter is String, 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.
This is an optional parameter.
- Parameters:
collapsedPointOption
- String, 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_POINTS—Specifies 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_KEEP—Specifies 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.
getErrorCheckingOption
public String getErrorCheckingOption()
- Returns the Check for topological errors parameter of this tool .
This parameter is String, specifies how the topological errors (possibly introduced in the process, including line crossing, line overlapping, and collapsed zero-length lines) will be handled.
This is an optional parameter.
- Returns:
- the Check for topological errors
setErrorCheckingOption
public void setErrorCheckingOption(String errorCheckingOption)
- Sets the Check for topological errors parameter of this tool .
This parameter is String, specifies how the topological errors (possibly introduced in the process, including line crossing, line overlapping, and collapsed zero-length lines) will be handled.
This is an optional parameter.
- Parameters:
errorCheckingOption
- String, specifies how the topological errors (possibly introduced in the process, including line crossing, line overlapping, and collapsed zero-length lines) will be handled.- CHECK—Specifies to check for topological errors and puts the error_resolving_option parameter in effect. This is the default.
- NO_CHECK—Specifies not to check for topological errors and disables the error_resolving_option parameter.
getOutPointFeatureClass
public Object getOutPointFeatureClass()
- Returns the Output Point Feature Class parameter of this tool (Read only).
This is an derived parameter.
- Returns:
- the Output Point Feature Class
getToolName
public String getToolName()
- Returns the name of this tool.
- Returns:
- the tool name
getToolboxName
public String getToolboxName()
- Returns the name of the tool box containing this tool.
- Returns:
- the tool box name
getToolboxAlias
public String getToolboxAlias()
- Returns the alias of the tool box containing this tool.
- Returns:
- the tool box alias