Label | Explanation | Data Type |
Input Features | The input dual-line features, such as road casings, from which centerlines will be derived. | Feature Layer |
Output Feature Class | The output feature class that will be created. | Feature Class |
Maximum Width | The maximum width of the dual-line features that will be used to derive a centerline. A value must be specified, and it must be greater than zero. You can specify a unit; the default is the feature unit. | Linear Unit |
Minimum Width (Optional) | The minimum width of the dual-line features that will be used to derive a centerline. The minimum width must be greater than or equal to zero, and it must be less than the maximum width. The default value is zero. You can specify a unit; the default is the feature unit. | Linear Unit |
Summary
Derives centerlines from dual-line (double-line) features, such as road casings, based on specified width tolerances.
Illustration
Usage
This tool is intended for regular, near parallel pairs of lines, such as large-scale road casings. Centerlines will be created only between open-ended lines, not inside closed lines, which are likely street blocks. The tool is not intended to simplify multiple-lane highways with interchanges, ramps, overpasses and underpasses, or railways with multiple, merging tracks. Use the Merge Divided Roads tool for those cases.
The output feature class will not carry the geographic attributes from the input lines but will include the following new fields:
- LnType—Contains the following line type values:
- A value of 1 is used for derived centerlines.
- A value of 2 is used for outlines around relatively complicated intersections where centerlines are not generated, lines representing roads with a width beyond the specified range, and other broken or unpaired lines.
- A value of 3 is used for lines with unclear source casings (they usually connect two closely located intersections, which may belong to one large intersection).
- LeftLn_FID—Carries the object ID of the input line to the left of a derived centerline. This field value will be zero for lines of LnType 2 and 3.
- RightLn_FID—Carries the object ID of the input line to the right of a derived centerline. This field value will be zero for lines of LnType 2 and 3.
You can use the LnType values to further inspect the unresolved intersections and wider roads; and you can use the LeftLn_FID and RightLn_FID fields along with the Join Field tool to transfer the attributes from source lines to the centerlines as needed.
- LnType—Contains the following line type values:
Parameters
arcpy.cartography.CollapseDualLinesToCenterline(in_features, out_feature_class, maximum_width, {minimum_width})
Name | Explanation | Data Type |
in_features | The input dual-line features, such as road casings, from which centerlines will be derived. | Feature Layer |
out_feature_class | The output feature class that will be created. | Feature Class |
maximum_width | The maximum width of the dual-line features that will be used to derive a centerline. A value must be specified, and it must be greater than zero. You can specify a unit; the default is the feature unit. | Linear Unit |
minimum_width (Optional) | The minimum width of the dual-line features that will be used to derive a centerline. The minimum width must be greater than or equal to zero, and it must be less than the maximum width. The default value is zero. You can specify a unit; the default is the feature unit. | Linear Unit |
Code sample
The following Python window script demonstrates how to use the CollapseDualLinesToCenterline function in immediate mode.
import arcpy
from arcpy import env
import arcpy.cartography as CA
env.workspace = "C:/data"
CA.CollapseDualLinesToCenterline("dual_line_roads.shp",
"C:/output/output.gdb/road_centerlines",
50)
The following stand-alone script demonstrates how to use the CollapseDualLinesToCenterline function.
# Name: CollapseDualLinesToCenterline_Example2.py
# Description: Create road centerlines and find buildings within a given distance
# Import system modules
import arcpy
from arcpy import env
import arcpy.cartography as CA
import arcpy.management as DM
import arcpy.analysis as AN
# Set environment settings
env.workspace = "C:/data/Portland.gdb"
# Set local variables
inRoadCasingsFeatures = "road_casings"
inHouseFeatures = "houses"
centerlineFeatures = "C:/data/PortlandOutput.gdb/road_centerlines"
bufferFeatures = "C:/data/PortlandOutput.gdb/road_buffers"
# Create centerlines for road casings.
CA.CollapseDualLinesToCenterline(inRoadCasingsFeatures, centerlineFeatures, 80)
# Create buffers 100 units from around centerlines.
AN.Buffer(centerlineFeatures, bufferFeatures, 100)
# Select houses by buffers.
DM.SelectLayerByLocation(inHouseFeatures, "intersect", bufferFeatures, 100)
Environments
Licensing information
- Basic: No
- Standard: No
- Advanced: Yes