Skip To Content

Remove Small Lines

Summary

Removes lines that are shorter than a specified minimum length and do not connect to other features on one end.

Illustration

Remove Small Lines example

Usage

    Caution:

    This tool modifies the input data. See Tools that do not create output datasets for more information and strategies to avoid undesired data changes.

    Caution:

    A warning is raised if the input features are not in a projected coordinate system. This tool relies on linear distance units, which will create unexpected results in an unprojected coordinate system. It is strongly suggested that you run this tool on data in a projected coordinate system to ensure valid results. An error is raised and the tool will not process if the coordinate system is missing or unknown.

  • This tool identifies small lines as line segments that are shorter than the Minimum Length and do not intersect or connect to other features at one end. The connecting or intersecting features can be in the same input line feature class or within any of the intersecting features' feature classes. In most scenarios, the tool only considers the length of an individual feature when determining the minimum length. In some scenarios the tool will only use the length of a segment of the line or the length of multiple lines.
  • When Recursive is enabled, all small lines that exist in the data, including small lines created as a result of removing the previous small lines, will be removed. This can result in the removal of a significant number of features in areas that primarily contain short line segments.
  • Overshoots exist if the start or end of a line extends a short distance past the intersection of another feature in the same feature class but the line is not split at the intersection. This tool considers overshoots that are shorter than the Minimum Length to be small lines, even if the entire length of the line is larger than the Minimum Length. When overshoots are identified, the feature will be modified to remove the overshoot. When the tool is executed, a message will be returned indicating how many features were modified.
  • Defining a Maximum Angle may help when trying to keep small lines in the cases where multiple small lines connect to another feature and create a Y or T intersection. The angle for each small line is calculated as the declination of the small line from the continued path of the main line feature. For example, a T intersection where the small line is perpendicular to the main road has a declination of 90 degrees where a small line that continues in a straight line from the main road has a declination of 0.
  • When a Maximum Angle is defined, any small line with a declination angle larger than the Maximum Angle will be removed. If multiple small lines have a declination that is smaller than the Maximum Angle, the small line with the smallest declination may be kept.
  • When a Maximum Angle is defined, the final operation after any recursion, is to determine if any of the small lines that were kept because they fall within the Maximum Angle should be deleted. In this scenario, the tool will look at the overall length of the small line and connecting line features, not the length of the individual small line. If the length of the small line and any features it connects to, up to the first intersection, is shorter than the Minimum Length, the small line and connecting features will be deleted. If the length of the combined features is longer than the Minimum Length, the small line will be kept even though the individual feature is shorter than the Minimum Length. The reason for this is that the geometries of small lines and connected features visually combine to create the appearance of a single segment that is longer than the Minimum Length. You can run the Unsplit Line geoprocessing tool after Remove Small Lines to combine the features into a single geometry that is longer than the Minimum Length.
  • Features connected to any feature class listed in the Intersecting Features are not considered small lines.
  • The integrity of the results of this tool relies on the topological integrity of the inputs. Take note of the following input data requirements and suggestions:

    • Connectivity—Proper connections must exist at intersections that faithfully represent the connectivity of the network.
    • Intersecting features—Lines should be split at all true intersections, but not at overpasses and underpasses. Intersections that are not split in the appropriate place may produce unexpected results because the connectivity of the streets was not accurately assessed.
    • False dead ends—A false dead end is an unconnected segment that appears visually connected when symbolized at the final map scale. These may be areas where you expect connectivity based on visual appearance, but features are not actually connected. If you process the tool without repairing the connectivity, unexpected disconnects may be considered small lines and removed.
    • Empty or null geometry—The Input Features must consist of valid geometries. If necessary, use the Repair Geometry geoprocessing tool to repair these features.
    • Single-part features—The Input Features should not contain multipart features. Use the Multipart To Singlepart tool or create a topology with a Must Be Single Part line rule to convert features to single-part features.
  • The integrity of the results relies on the topological integrity of the inputs. Proper connections must exist at intersections to faithfully represent the connectivity of the input lines. When the Split Input Lines option is enabled, the tool will automatically split lines at intersections to ensure connectivity before determining if any small lines need to be removed. The results will not be split at intersections. If the tool determines a split feature will be removed, the original feature will be modified to remove only this portion of the line. If you know the topological integrity of the inputs is correct, you can disable this option for faster processing.

  • During processing, the Some geometries are not split at intersections warning is returned for some data sets. Results may not be as expected, and the user should enable the Split Input Lines option or run a tool like Feature to Line to ensure the appropriate segmentation before running the tool.

  • During processing, a warning is returned when one or more small lines are maintained because they have a declination that is smaller than the Maximum Angle. This warning is returned as some features smaller than the minimum length may remain in the resulting data. While the length of the individual features may be shorter than the minimum length, the overall visual length of the small line and connecting line features will be greater than the minimum length.

Syntax

RemoveSmallLines_topographic (in_features, minimum_length, {maximum_angle}, {in_intersecting_features}, {recursive}, {split_input_lines})
ParameterExplanationData Type
in_features

The features that will have small lines eliminated.

Feature Layer
minimum_length

The minimum length for input lines. Features shorter than this distance will be deleted.

Linear Unit
maximum_angle
(Optional)

Any line below the minimum length that is within the defined angle of a consecutive line segment will be kept.

Long
in_intersecting_features
[in_intersecting_features,...]
(Optional)

Additional intersecting features that the input features can be compared against when determining whether the feature is a small line.

Feature Layer
recursive
(Optional)

Indicates the method used to remove small lines on the line features.

  • NON_RECURSIVEAll the small lines on lines are deleted. The remaining lines are not analyzed to see if they are small lines. This is the default.
  • RECURSIVEThe small lines are deleted from the lines and the remaining lines are analyzed to see if they are considered small lines. If they do not meet the minimum_length value, they are considered small lines and deleted.
Boolean
split_input_lines
(Optional)

Splits the input line feature at all intersections before determining which small lines to remove.

  • SPLITAll lines in the input feature class are split at intersections to ensure topological integrity. The length of the split features, not the original feature geometries, will be considered when applying the minimum length value to determine small lines. This is the default.
  • NO_SPLITDoes not split lines before determining which lines to remove. Uses the length of the input feature geometries when applying the minimum length value to determine small lines.
Boolean

Derived Output

NameExplanationData Type
output_features

Features where small lines have been removed based on input criteria.

Feature Layer

Code sample

RemoveSmallLines example (stand-alone script)

The following stand-alone sample script demonstrates how to use RemoveSmallLines.

# Name: RemoveSmallLines_sample.py
# Description: Remove Small Lines removes unconnected lines less than
# a certain length unless within a defined angle.

# Import arcpy module
import arcpy

# Check out Production Mapping License
arcpy.CheckOutExtension("foundation")

# Set workspace
arcpy.env.workspace = r'C:\data\LocalGovernment.gdb'

# Define variables
in_features = r'ReferenceData\RoadCenterline'
in_intersecting_features = r'ReferenceData\MedicalFacility'
in_featuresLyr = 'RoadL_Lyr'
in_intersecting_featuresLyr = 'MedicalFacility_Lyr'
minimum_length = '100 Feet'
maximum_angle = '45'
recursive = 'NON_RECURSIVE'

# Create an input feature layer for Remove Small Lines
arcpy.MakeFeatureLayer_management(in_features,in_featuresLyr)
arcpy.MakeFeatureLayer_management(in_intersecting_features, in_intersecting_featuresLyr)

# Execute Remove Small Lines
arcpy.topographic.RemoveSmallLines(in_featuresLyr,minimum_length,maximum_angle,in_intersecting_featuresLyr,recursive)

# Check in Production Mapping License
arcpy.CheckInExtension('foundation')

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: No
  • Standard: Requires Production Mapping
  • Advanced: Requires Production Mapping

Related topics