Summary
Derives centerlines from dual-line (or 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 instead.
This tool cannot be executed within an edit session.
The output feature class will not carry the geographic attributes from the input lines, but contain the following three new fields:
- LnType—Contains the following line type values:
- Value of 1 for derived centerlines
- Value of 2 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.
- Value of 3 for lines with unclear source casings (they usually connect two closely located intersections which may belong to one large intersection in reality.)
- 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 Join Field tool to transfer the attributes from source lines to the centerlines as needed.
- LnType—Contains the following line type values:
Syntax
CollapseDualLinesToCenterline_cartography (in_features, out_feature_class, maximum_width, {minimum_width})
Parameter | Explanation | Data Type |
in_features | The input dual-line features, such as road casings, from which centerlines are derived. | Feature Layer |
out_feature_class | The output feature class to be created. | Feature Class |
maximum_width | Sets the maximum width of the dual-line features to derive centerline. A value must be specified, and it must be greater than zero. You can choose a preferred unit; the default is the feature unit. | Linear unit |
minimum_width (Optional) | Sets the minimum width of the dual-line features to derive 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 preferred unit; the default is the feature unit. | Linear unit |
Code Sample
CollapseDualLinesToCenterline Example (Python Window)
The following Python window script demonstrates how to use the CollapseDualLinesToCenterline tool 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)
CollapseDualLinesToCenterline Example 2 (stand-alone script)
The following stand-alone script demonstrates how to use the CollapseDualLinesToCenterline tool.
# Name: CollapseDualLinesToCenterline_Example2.py
# Description: Create road centerlines and find buildings within a given distance
# Author: ESRI
# 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
- ArcGIS for Desktop Basic: No
- ArcGIS for Desktop Standard: No
- ArcGIS for Desktop Advanced: Yes