Merge Divided Roads (Cartography)

Summary

Generates single-line road features in place of matched pairs of divided road lanes.

Matched pairs of roads or lanes are merged if they are the same road class, trend generally parallel to one another, and are within the merge distance apart. The road class is specified by the Merge Field parameter. All nonmerged roads from the input collection are copied to the output feature class.

Learn more about how Merge Divided Roads works

Tip:

This tool is frequently used to simplify a larger-scale road collection at a smaller scale when it is appropriate to depict divided highways and boulevards as a single line. At medium scales, it may be preferable to retain divided roads as separate features. In this case, you can use the Resolve Road Conflicts tool instead to ensure that symbolized lanes are displayed without symbol conflicts. If both the Resolve Road Conflicts and Merge Divided Roads tools will be run on the same collection of roads, use the Merge Divided Roads tool first.

Caution:

A warning is issued 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 recommended that you run this tool on data in a projected coordinate system to ensure valid results. An error occurs and the tool will not process if the coordinate system is missing or unknown.

Illustration

Merge Divided Roads tool example
The Merge Divided Roads tool creates single-line road features in place of divided roads.

Usage

  • The output feature class contains single-line features representing merged roads and copies of all unmerged input features. Merged features will inherit attributes from one of the two input features. You can create a many-to-many output relationship table to link the merged road features to their source features. Relationships can become out of sync if any of the input or output features are subsequently modified.

  • Input features with the Merge Field parameter value equal to zero are locked and will not be merged, even if adjacent features are not locked.

  • The optional Output Displacement Feature Class parameter creates a feature class of polygons that indicates the amount and direction of displacement that took place. You can use this feature class for visual inspection and spatial querying or as an input to the Propagate Displacement tool.

  • If the input is a feature layer drawn with a representation, any shape overrides associated with the representation will be used as the input geometry considered by this tool, and the corresponding geometry in the Shape field will be ignored. The output feature class will contain the feature class representation, but all geometry will be stored in the output Shape field, not as representation shape overrides.

  • In complex or unusual geometry, consider populating a field with values that classify the road character and using this field in the Road Character Field parameter. These values help the tool to refine the assessment of candidate feature pairs for merging.

    Field values are assessed as follows:

    • 0—Traffic circles or roundabouts
    • 1—Carriageways, boulevards, dual-lane highways, or other parallel trending roads
    • 2—On- or off-ramps, highway intersection connectors
    • 999—Features will not be merged

  • Domains and subtypes are copied to the output even if the Transfer field domain, subtypes and attributes rules environment is unchecked.

  • Processing a large road dataset may exceed memory limitations. In this case, consider processing input data by partition by identifying a relevant polygon feature class in the Cartographic Partitions environment setting. Portions of the data, defined by partition boundaries, will be processed sequentially. The resulting feature classes will be seamless and consistent at partition edges. See How Merge Divided Roads works for more information about running this tool with partitioning.

Parameters

LabelExplanationData Type
Input Features

The input linear road features that contain matched pairs of divided road lanes that will be merged into a single output line feature.

Feature Layer
Merge Field

The field that contains road classification information. Only parallel, proximate roads of equal classification will be merged. A value of 0 (zero) locks a feature to prevent it from participating in merging.

Field
Merge Distance

The minimum distance apart, in the specified units, for equal-class, relatively parallel road features to be merged. This distance must be greater than zero. If the units are in points, millimeters, centimeters, or inches, the value is considered as page units and takes into account the reference scale.

Linear Unit
Output Features

The output feature class containing single-line merged road features and all unmerged road features.

Feature Class
Output Displacement Feature Class
(Optional)

The output polygon features containing the degree and direction of road displacement.

Feature Class
Road Character Field
(Optional)

Specify a numeric field that indicate the character of road segments, independent of their road classification. These values help the tool to refine the assessment of candidate feature pairs for merging. Use this parameter in unusual or complex road networks to improve the quality of the output. If there are null values (or if this parameter is not specified at all), the road character (and merge candidacy) is based only on the shapes and arrangement of features. Use value 999 to lock features from participating in a merge at all.

Field values are assessed as follows:

  • 0—Traffic circles or roundabouts
  • 1—Carriageways, boulevards, dual-lane highways, or other parallel trending roads
  • 2—On- or off-ramps, highway intersection connectors
  • 999—Features will not be merged

Field
Output Table
(Optional)

A many-to-many relationship table that links the merged road features to their source features. This table contains two fields, OUTPUT_FID and INPUT_FID, which store the merged feature IDs and their source feature IDs, respectively. Use this table to derive necessary attributes for the output features from their source features. No table is created when this parameter is left blank.

Table

arcpy.cartography.MergeDividedRoads(in_features, merge_field, merge_distance, out_features, {out_displacement_features}, {character_field}, {out_table})
NameExplanationData Type
in_features

The input linear road features that contain matched pairs of divided road lanes that will be merged into a single output line feature.

Feature Layer
merge_field

The field that contains road classification information. Only parallel, proximate roads of equal classification will be merged. A value of 0 (zero) locks a feature to prevent it from participating in merging.

Field
merge_distance

The minimum distance apart, in the specified units, for equal-class, relatively parallel road features to be merged. This distance must be greater than zero. If the units are in points, millimeters, centimeters, or inches, the value is considered as page units and takes into account the reference scale.

Linear Unit
out_features

The output feature class containing single-line merged road features and all unmerged road features.

Feature Class
out_displacement_features
(Optional)

The output polygon features containing the degree and direction of road displacement.

Feature Class
character_field
(Optional)

Specify a numeric field that indicate the character of road segments, independent of their road classification. These values help the tool to refine the assessment of candidate feature pairs for merging. Use this parameter in unusual or complex road networks to improve the quality of the output. If there are null values (or if this parameter is not specified at all), the road character (and merge candidacy) is based only on the shapes and arrangement of features. Use value 999 to lock features from participating in a merge at all.

Field values are assessed as follows:

  • 0—Traffic circles or roundabouts
  • 1—Carriageways, boulevards, dual-lane highways, or other parallel trending roads
  • 2—On- or off-ramps, highway intersection connectors
  • 999—Features will not be merged

Field
out_table
(Optional)

A many-to-many relationship table that links the merged road features to their source features. This table contains two fields, OUTPUT_FID and INPUT_FID, which store the merged feature IDs and their source feature IDs, respectively. Use this table to derive necessary attributes for the output features from their source features. No table is created when this parameter is left blank.

Table

Code sample

MergeDividedRoads example 1 (Python window)

The following Python window script demonstrates how to use the MergeDividedRoads function in immediate mode.

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.env.referenceScale = 50000
arcpy.MergeDividedRoads_cartography("roads.lyr", "level", "25 meters",
                                    "C:/data/cartography.gdb/transportation/merged_roads",
                                    "C:/data/cartography.gdb/transportation/displacement",
                                    "RoadChar", "C:/data/cartography.gdb/mergetable_tbl")
MergeDividedRoads example 2 (stand-alone script)

This stand-alone script shows an example of using the MergeDividedRoads function.

# Name: MergeDividedRoads_standalone_script.py
# Description: Resolves symbology conflicts between roads within
#              a specified distance of each other by snapping them together

# Import system modules
import arcpy

# Set environment settings
arcpy.env.workspace = "C:/data"
arcpy.env.referenceScale = "50000"

# Set local variables
in_features = "roads.lyrx"
merge_field = "level"
collapse_distance = "25 meters"
out_features = "cartography.gdb/transportation/merged_roads"
out_displacement_features = "cartography.gdb/transportation/displacement"
out_table = "cartography.gdb/outtable_tbl"

# Execute Merge Divided Roads
arcpy.cartography.MergeDividedRoads(in_features, merge_field,
                                    collapse_distance, out_features,
                                    out_displacement_features, out_table)

Environments

Special cases

Reference Scale

The reference scale is only considered when the Merge Distance parameter is entered in page units. When the reference scale is available, the detection of false dead-ends is based on a feature separation of 0.5 mm at scale; otherwise, a value twice the tolerance of the spatial reference is used.

Licensing information

  • Basic: No
  • Standard: No
  • Advanced: Yes

Related topics