Label | Explanation | Data Type |
Input Features | The input line or polygon features. | Feature Layer |
Output Feature Class | The output line feature class. | Feature Class |
Summary
Creates a polyline feature class by splitting input lines or polygons at their vertices.
Illustration
Usage
The attributes of the input features will be maintained in the output feature class. The following fields will be added to the output feature class:
- ORIG_FID—Stores the feature IDs of the input features
- ORIG_SEQ—Stores the sequence number for each output line following the order of the segments from the starting vertex of the input feature
If an input line has only two vertices, the line will be copied to the output as is. Otherwise, every segment between consecutive vertices will become a line feature in the output. The output feature class can be a much larger file, depending on the number of vertices the input features have.
A parametric (true) curve line or segment will not be densified and will remain a true curve as an output line feature. This does not apply to shapefile data.
Parameters
arcpy.management.SplitLine(in_features, out_feature_class)
Name | Explanation | Data Type |
in_features | The input line or polygon features. | Feature Layer |
out_feature_class | The output line feature class. | Feature Class |
Code sample
The following Python window script demonstrates how to use the SplitLine function in immediate mode.
import arcpy
arcpy.env.workspace = "C:/data"
arcpy.management.SplitLine("roads.shp", "c:/output/output.gdb/roads_split")
The following stand-alone script is an example of how to apply the SplitLine function in a scripting environment.
# Name: SplitLine_Example2.py
# Description: Split a bus line feature at its vertices (bus stops)
# and find a midpoint of each new line for further analysis.
# import system modules
import arcpy
# Set environment settings
arcpy.env.workspace = "C:/data"
# Set local variables
inFeatures = "buslines.shp"
outFeatureClass = "c:/output/output.gdb/buslines_segments"
midPtsFeatureClass = "c:/output/output.gdb/buslines_segments_midPts"
# Run SplitLine to get new lines, each of which is between two bus stops
arcpy.management.SplitLine(inFeatures, outFeatureClass)
# Run FeatureVerticesToPoints to find a midpoint for every new line
arcpy.management.FeatureVerticesToPoints(outFeatureClass,
midPtsFeatureClass, "MID")
# Comments: You can add attribute information, such as driving time,
# to the midpoint feature class and display the attributes
# as an alternative label for each line between two bus stops.