Apply Relative Mainline Layout (Network Diagram)

Summary

Arranges the network diagram features in the active diagram along parallel straight lines.

Learn more about the Relative Mainline layout algorithm

Caution:

If you have an open edit session, you must save your edits prior to running this tool. This ensures that the diagram reflects the latest changes made to the network topology in the database. If you fail to save your edits, the edits will not be reflected in the diagram.

Note:

Each layout algorithm includes default parameter values. The default parameter values will be used unless otherwise specified. If the input network diagram is based on a template for which this layout has been configured with a different parameter value, that value will be used instead.

Usage

  • This tool is not supported when working with a database connection to a utility network or trace network in an enterprise geodatabase. You must use either the related published utility network or trace network service, or a utility network or trace network in a file or mobile geodatabase.

  • The input network diagram layer must be from either a utility network or a trace network in a file or mobile geodatabase. or a network diagram service.

  • This layout algorithm arranges the network diagram features in the active diagram along parallel straight lines, with all the connected edges having the same attribute value. It also places the branches from those lines, preserving their directions regarding the straight lines and the distances proportional to the initial distance and relative to each other.

  • This algorithm layout requires network attributes with specific values on the network line classes to identify the edges that compose each straight line and classify each edge so it is prioritized or excluded during the process.

  • This layout can apply to any data referencing lines that are parallel, even if they have not been designed for rail tracks.

  • Root flags can be set to specify the points of the junctions where the straight lines will start. If no root is set, the algorithm layout first searches for junctions that are connected to a single edge that can be considered the starting point of a straight line. From these junction candidates, the root junction will be the one that begins the longest straight line.

  • Consider applying the layout in asynchronous mode on the server when working on very large diagrams.

Parameters

LabelExplanationData Type
Input Network Diagram Layer

The network diagram to which the layout will be applied.

Diagram Layer
Line Attribute

The name of the network attribute that will be used to identify the lines that comprise the straight lines. This network attribute must exist in the network line classes. Its values must be the same for all the edges that comprise a straight line, for example, Line 1, Line 2, and so on.

String
Direction
(Optional)

Specifies the direction of the main line.

  • From left to rightThe main line will be drawn as a horizontal line starting from the left and ending on the right. This is the default.
  • From top to bottomThe main line will be drawn as a vertical line starting from the top and ending at the bottom.
String
Offset Between Branches
(Optional)

The spacing between two adjacent branches along the axis perpendicular to the direction of the lines.

Linear Unit
Break Point Angle (in degrees)
(Optional)

The angle that will be used to position the break point on the branches. It is a value between 30 and 90 degrees that is combined with the Offset Between Branches parameter value to compute this position. When the break point angle value is 90 degrees, each branch displays orthogonally.

Double
Type Attribute
(Optional)

The name of the network attribute that will be used to qualify the lines. This network attribute may exist in the network line classes.

Note:

The Type Attribute and Line Attribute parameter values can be the same.

String
Mainline Values
(Optional)

The Type Attribute values that identify the main lines. When such values exist, they must be the same for any edge that comprises the main lines, regardless of their related network feature line classes or edge object tables.

Value Table
Branch Values
(Optional)

The Type Attribute values that identify the branches.

Value Table
Excluded Values
(Optional)

The Type Attribute values that identify the edges that will be excluded from the straight lines (crossovers or ladders).

Value Table
Compression along the direction
(Optional)

Specifies whether the graph will be compressed.

  • Checked—Compression will be used. An additional step is run at the end of the process to reduce the distances between adjacent groups of neighbor junctions along the direction while maintaining relative positioning between these groups. Neighbor junctions are junctions that are geographically close to each other without being directly connected.
  • Unchecked—Compression will not be used. This is the default.

Boolean
Ratio (%)
(Optional)

A value between 0 and 100 that is applied to the length of any edge after subtracting the minimal distance of its length. When the value is 100, the distance between each detected junction group is equal to the minimal distance.

Double
Minimal Distance
(Optional)

The minimal distance between two adjacent groups of neighbor junctions. This minimal distance is also used to group neighbor junctions based on their projection along the direction axis. Two junctions projected on this axis will belong to the same group when the distance between the two projected points is less than this distance.

Linear Unit
Alignment Attribute
(Optional)

The name of the network attribute that will be used to align lines that are split. Lines with the same attribute value will be aligned.

String
Initial Distances
(Optional)

Specifies how the length of the diagram edges will be assessed. This length determines the positions of the junctions along the direction. The distances between the connected junctions along the direction are not equidistant; they are relative to each other and depend on the current edge length and the length of the shortest edge.

  • From current edge geometry The distances will be computed from the current edge geometry. This is the default.
  • From attribute edgeThe distances will be computed from a given attribute that exists on an edge.
String
Length Attribute
(Optional)

The network attribute from which the distances will be computed when Initial Distances is From attribute edge.

String
Run in asynchronous mode on the server
(Optional)

Specifies whether the layout algorithm will run asynchronously or synchronously on the server.

  • Checked—The layout algorithm will run asynchronously on the server. This option dedicates server resources to run the layout algorithm with a longer time-out. Running asynchronously is recommended for layouts that are time consuming and may exceed the server time-out (for example, Partial Overlapping Edges) and applying to large diagrams (more than 25,000 features).
  • Unchecked—The layout algorithm will run synchronously on the server. It can fail without completion if it exceeds the service default time-out value of 600 seconds. This is the default.

Boolean

Derived Output

LabelExplanationData Type
Output Network Diagram

The updated network diagram.

Diagram Layer

arcpy.nd.ApplyRelativeMainlineLayout(in_network_diagram_layer, line_attribute, {mainline_direction}, {offset_between_branches}, {breakpoint_angle}, {type_attribute}, {mainline_values}, {branch_values}, {excluded_values}, {is_compressing}, {compression_ratio}, {minimal_distance}, {alignment_attribute}, {initial_distances}, {length_attribute}, {run_async})
NameExplanationData Type
in_network_diagram_layer

The network diagram to which the layout will be applied.

Diagram Layer
line_attribute

The name of the network attribute that will be used to identify the lines that comprise the straight lines. This network attribute must exist in the network line classes. Its values must be the same for all the edges that comprise a straight line, for example, Line 1, Line 2, and so on.

String
mainline_direction
(Optional)

Specifies the direction of the main line.

  • FROM_LEFT_TO_RIGHTThe main line will be drawn as a horizontal line starting from the left and ending on the right. This is the default.
  • FROM_TOP_TO_BOTTOMThe main line will be drawn as a vertical line starting from the top and ending at the bottom.
String
offset_between_branches
(Optional)

The spacing between two adjacent branches along the axis perpendicular to the direction of the lines.

Linear Unit
breakpoint_angle
(Optional)

The angle that will be used to position the break point on the branches. It is a value between 30 and 90 degrees that is combined with the offset_between_branches parameter value to compute this position. When the break point angle value is 90 degrees, each branch displays orthogonally.

Double
type_attribute
(Optional)

The name of the network attribute that will be used to qualify the lines. This network attribute may exist in the network line classes.

Note:

The type_attribute and line_attribute parameter values can be the same.

String
mainline_values
[mainline_values,...]
(Optional)

The type_attribute values that identify the main lines. When such values exist, they must be the same for any edge that comprises the main lines, regardless of their related network feature line classes or edge object tables.

Value Table
branch_values
[branch_values,...]
(Optional)

The type_attribute values that identify the branches.

Value Table
excluded_values
[excluded_values,...]
(Optional)

The type_attribute values that identify the edges that will be excluded from the straight lines (crossovers or ladders).

Value Table
is_compressing
(Optional)

Specifies whether the graph will be compressed.

  • USE_COMPRESSIONCompression will be used. An additional step is run at the end of the process to reduce the distances between adjacent groups of neighbor junctions along the direction while maintaining relative positioning between these groups. Neighbor junctions are junctions that are geographically close to each other without being directly connected.
  • DO_NOT_USE_COMPRESSIONCompression will not be used. This is the default.
Boolean
compression_ratio
(Optional)

A value between 0 and 100 that is applied to the length of any edge after subtracting the minimal distance of its length. When the value is 100, the distance between each detected junction group is equal to the minimal distance.

Double
minimal_distance
(Optional)

The minimal distance between two adjacent groups of neighbor junctions. This minimal distance is also used to group neighbor junctions based on their projection along the direction axis. Two junctions projected on this axis will belong to the same group when the distance between the two projected points is less than this distance.

Linear Unit
alignment_attribute
(Optional)

The name of the network attribute that will be used to align lines that are split. Lines with the same attribute value will be aligned.

String
initial_distances
(Optional)

Specifies how the length of the diagram edges will be assessed. This length determines the positions of the junctions along the direction. The distances between the connected junctions along the direction are not equidistant; they are relative to each other and depend on the current edge length and the length of the shortest edge.

  • FROM_CURRENT_EDGE_GEOMETRY The distances will be computed from the current edge geometry. This is the default.
  • FROM_ATTRIBUTE_EDGEThe distances will be computed from a given attribute that exists on an edge.
String
length_attribute
(Optional)

The network attribute from which the distances will be computed when initial_distances is FROM_ATTRIBUTE_EDGE.

String
run_async
(Optional)

Specifies whether the layout algorithm will run asynchronously or synchronously on the server.

  • RUN_ASYNCHRONOUSLYThe layout algorithm will run asynchronously on the server. This option dedicates server resources to run the layout algorithm with a longer time-out. Running asynchronously is recommended for layouts that are time consuming and may exceed the server time-out (for example, Partial Overlapping Edges) and applying to large diagrams (more than 25,000 features).
  • RUN_SYNCHRONOUSLYThe layout algorithm will run synchronously on the server. It can fail without completion if it exceeds the service default time-out value of 600 seconds. This is the default.
Boolean

Derived Output

NameExplanationData Type
out_network_diagram_layer

The updated network diagram.

Diagram Layer

Code sample

ApplyRelativeMainlineLayout example (Python window)

Run the ApplyRelativeMainlineLayout function on the diagram called Temporary Diagram.

import arcpy
arcpy.nd.ApplyRelativeMainlineLayout("Temporary Diagram", "LineTrack", 
                                     "FROM_LEFT_RIGHT", 2, 45, "RUN_SYNCHRONOUSLY")

Environments

This tool does not use any geoprocessing environments.

Licensing information

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

Related topics