Feature To Line (Data Management)
Summary
Creates a feature class containing lines generated by converting polygon boundaries to lines, or splitting line, polygon, or both features at their intersections.
Illustration
Usage
-
Input attributes can optionally be maintained in the output feature class, determined by the Preserve attributes option on the dialog box (the attributes parameter in scripting).
-
When multiple feature classes or layers are specified in the list of input features, the order of the entries in the list does not affect the output feature type, but the spatial reference of the top entry on the tool dialog box (the first entry in scripting) in the list will be used during processing and set to the output.
-
Where input lines or polygon boundaries touch, cross, or overlap each other at locations other than their start and end vertices, they will be split at those intersections; each of the split lines will become an output line feature. If an input line or polygon boundary is not intersected by another feature, its entire shape will still be written out as a line feature.
-
For multipart input features, the output lines will be singlepart.
-
For input features that are parametric (true) curves, the output lines will remain true curves even if they are split. This does not apply to shapefile data.
-
If the Preserve attributes option on the dialog box is checked (the attributes parameter is set to ATTRIBUTES in scripting), the attributes from all input entries will be maintained in the output in the order they appear in the input list. A new field, FID_xxx, where xxx is the source feature class name of a particular input entry, will be added to the output for each input entry and set to the source feature IDs. The output lines are associated with their attributes in the following ways:
- For coincident lines or polygon boundaries within the same set of input features, for example, the boundary separating two polygons, two line features with identical geometry will be written to the output: each of them will have the attributes of its source feature.
- For coincident lines or polygon boundaries from two different sets of input features, for example, a line overlapping a polygon boundary, only one line feature with the attributes of both source features will be written to the output.
- If an output line does not overlap any feature in a particular input feature set, it will have the value of -1 in the FID_xxx field and zero or null values in the other fields from that feature set.
If the Preserve attributes option on the dialog box is unchecked (the attributes parameter is set to NO_ATTRIBUTES in scripting), none of the input attributes will be maintained in the output feature class; a single line feature will be written to the output for each set of coincident lines or polygon boundaries.
-
When input features contain adjacent polygons, to get the shared boundary line with left and right polygon feature IDs as attributes in the output, use the Polygon To Line tool instead.
-
This tool will use a tiling process to handle very large datasets for better performance and scalability. For more details, see Geoprocessing with large datasets.
Syntax
Parameter | Explanation | Data Type |
in_features [in_features,...] |
The input features that can be line or polygon, or both. | Feature Layer |
out_feature_class |
The output line feature class. | Feature Class |
cluster_tolerance (Optional) |
The minimum distance separating all feature coordinates, and the distance a coordinate can move in X, Y, or both during spatial computation. The default XY tolerance is set to 0.001 meter or its equivalent in feature units. | Linear unit |
attributes (Optional) |
Specifies whether to preserve or omit the input attributes in the output feature class.
| Boolean |
Code Sample
The following Python window script demonstrates how to use the FeatureToLine function in immediate mode.
import arcpy
from arcpy import env
env.workspace = "C:/data"
arcpy.FeatureToLine_management(["majorrds.shp", "habitat_analysis.gdb/futrds"],
"c:/output/output.gdb/allroads",
"0.001 Meters", "ATTRIBUTES")
The following stand-alone script is an example of how to apply the FeatureToLine function in a scripting environment.
# Name: FeatureToLine_Example2.py
# Description: Use FeatureToLine function to combine features from two
# street feature classes into a single feature class,
# then determine an area of impact around all streets
# by buffering
# import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "C:/data"
# Set local variables
oldStreets = "majorrds.shp"
newStreets = "habitat_analysis.gdb/futrds"
uptodateStreets = "c:/output/output.gdb/allroads"
# Use FeatureToLine function to combine features into single feature class
arcpy.FeatureToLine_management([oldStreets, newStreets], uptodateStreets,
"0.001 Meters", "ATTRIBUTES")
# Use Buffer function to determine area of impact around streets
roadsBuffer = "c:/output/output.gdb/buffer_output"
arcpy.Buffer_analysis(uptodateStreets, roadsBuffer, "50 Feet",
"FULL", "ROUND", "ALL")