Apply Mainline Tree Layout (Network Diagram)

Summary

Arranges diagram junctions and edges hierarchically along a main line.

Learn more about the Mainline Tree 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 junctions and edges in the input network diagram hierarchically along a main line and places its related branches on the left side, the right side, or both sides of the main line.

  • Root and end junctions can be specified in the diagram so the Mainline Tree layout algorithm will build a main line starting at a specified root junction and ending at a specified end junction.

    • By default, when no root and end junctions are specified, the algorithm identifies the diagram junction associated with the smallest network topology index. Starting from this junction representing the root, the algorithm searches for a line composed of the greatest number of edges: the main line.
    • When a root junction is set, the main line is one of the branches composed of the greatest number of edges starting from this root junction.
    • When both root and end junctions are specified and there is a path between them, the main line is the branch composed of the greatest number of diagram edges starting from this root junction and ending at this end junction.

    If your network diagram is composed of several disconnected diagram parts, you can define several root and end junctions, for example, one for each part of the diagram.

    Several junctions that belong to the same connected diagram part can also be specified as roots. They are all aligned along the same axis perpendicularly to the tree direction and appear as different start points for a tree branch of the diagram. For end junctions, although nothing prevents you from specifying several ends on the same connected diagram part, the system identifies only one of them as the end junction.

    If an end junction is specified but no root junction is specified, the end junction is ignored.

  • 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
Preserve container layout
(Optional)

Specifies how the algorithm will process containers.

  • Checked—The layout algorithm will execute on the top graph of the diagram so containers are preserved.
  • Unchecked—The layout algorithm will execute on both content and noncontent features in the diagram. This is the default.

Boolean
Tree 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 right to leftThe main line will be drawn as a horizontal line starting from the right and ending on the left.
  • From bottom to topThe main line will be drawn as a vertical line starting from the bottom and ending at the top.
  • From top to bottomThe main line will be drawn as a vertical line starting from the top and ending at the bottom.
String
Branches Placement
(Optional)

Specifies how branches from the main line will be relatively placed with regard to its direction.

  • Both sidesBranches will be placed on both the left and right sides of the main line. This is the default.
  • Left sideBranches will only be placed on the left side of the main line.
  • Right sideBranches will only be placed on the right side of the main line.
String
Spacing values interpreted as absolute units in the diagram coordinate system
(Optional)

Specifies how parameters representing distances will be interpreted.

  • Checked—The layout algorithm will interpret any distance values as linear units.
  • Unchecked—The layout algorithm will interpret any distance values as relative units to an estimation of the average of the junction sizes in the current diagram extent. This is the default.

Boolean
Between Junctions Perpendicular to the Direction
(Optional)

The spacing between diagram junctions that are displayed along the axis perpendicular to the main line. The default is 2 in the diagram's coordinate system. This parameter can only be used with absolute units.

Linear Unit
Between Junctions Perpendicular to the Direction
(Optional)

The spacing between diagram junctions that are displayed along the axis perpendicular to the main line. The default is 2. This parameter can only be used with proportional units.

Double
Between Junctions Along the Direction
(Optional)

The spacing between diagram junctions that are displayed along the main line, as well as the spacing between diagram junctions that are displayed along the axis parallel to the main line. This parameter can only be used with absolute units. The default is 2 in the units of the diagram's coordinate system.

Linear Unit
Between Junctions Along the Direction
(Optional)

The spacing between diagram junctions that are displayed along the main line, as well as the spacing between diagram junctions that are displayed along the axis parallel to the main line. This parameter is used with proportional units. The default is 2.

Double
Between Disjoined Graphs
(Optional)

The minimum spacing that will separate features belonging to disjoined graphs when the diagram contains such graphs. This parameter is used with absolute units. The default is 4 in the units of the diagram's coordinate system.

Linear Unit
Between Disjoined Graphs
(Optional)

The minimum spacing that will separate features belonging to disjoined graphs when the diagram contains such graphs. This parameter is used with proportional units. The default is 4.

Double
Orthogonally display edges
(Optional)
Boolean
Break Point Relative Position (%)
(Optional)

The relative position of the break point that will be inserted along the diagram edges when Edge Display Type is set to Regular edges (edge_display_type = "REGULAR_EDGES" in Python) or Edge Display Type is set to Orthogonal edges (edge_display_type = "ORTHOGONAL_EDGES" in Python). It is a percentage between 0 and 100.

  • With a Break Point Relative Position (%) value of 0, the break point is positioned at the x-coordinate of the edge's from junction and at the y-coordinate of the edge's to junction for a horizontal tree. It is positioned at the y-coordinate of the edge's from junction and at the x-coordinate of the edge's to junction for a vertical tree.
  • With a Break Point Relative Position (%) value of 100, there is no break point inserted on the diagram edges; each diagram edge directly connects its from and to junctions.
  • With a Break Point Relative Position (%) value of N between 0 and 100, the break point is positioned at N% of the length of the [XY] segment, X being the x-coordinate of the edge's from junction and Y being the y-coordinate of the edge's to junction for a horizontal tree. It is positioned at N% of the length of the [YX] segment, Y being the y-coordinate of the edge's from junction and X being the x-coordinate of the edge's to junction for a vertical tree.

The relative position of the two inflection points that will be inserted along the diagram edges to compute the curved edges geometry when Edge Display Type is set to Curved edges (edge_display_type = "CURVED_EDGES" in Python). It is a percentage between 15 and 40. With a Break Point Relative Position (%) value of N between 15 and 40:

  • X being the x-coordinate of the edge's from junction and Y being the y-coordinate of the edge's to junction for a horizontal tree:
    • The first inflection point will be positioned at N% of the length of the [XY] segment.
    • The second inflection point will be positioned at (100 - N)% of the length of the [XY] segment.
  • Y being the y-coordinate of the edge's from junction and X being the x-coordinate of the edge's to junction for a vertical tree:
    • The first inflection point will be positioned at N% of the length of the [YX] segment.
    • The second inflection point will be positioned at (100 - N)% of the length of the [XY] segment.

Note:

The concept of the from and to junctions above is relative to the tree direction; it has nothing to do with the real topology of the edge feature or edge object in the network.

Double
Edge Display Type
(Optional)

Specifies the type of display for the diagram edges related to the tree branches.

  • Regular edgesAll diagram edges related to the tree branches will not display with right angles. This is the default.
  • Orthogonal edgesAll diagram edges related to the tree branches will display with right angles.
  • Curved edgesAll diagram edges related to the tree branches will be curved.
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 when executing 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 its execution exceeds the service default time-out value of 600 seconds. This is the default.

Boolean
Absolute Offset
(Optional)

The offset that will be used to separate overlapping segments when using absolute units and Edge Display Type is set to Orthogonal edges. The value cannot exceed 10 percent of the smallest value specified for the other spacing parameters. The default is 0.

Linear Unit
Proportional Offset
(Optional)

The offset that will be used to separate overlapping segments when using proportional units and Edge Display Type is set to Orthogonal edges. It is a double value that cannot exceed 10 percent of the smallest value specified for the other spacing parameters. The default is 0.

Double

Derived Output

LabelExplanationData Type
Output Network Diagram

The updated network diagram layer.

Diagram Layer

arcpy.nd.ApplyMainlineTreeLayout(in_network_diagram_layer, {are_containers_preserved}, {tree_direction}, {branches_placement}, {is_unit_absolute}, {perpendicular_absolute}, {perpendicular_proportional}, {along_absolute}, {along_proportional}, {disjoined_graph_absolute}, {disjoined_graph_proportional}, {are_edges_orthogonal}, {breakpoint_position}, {edge_display_type}, {run_async}, {offset_absolute}, {offset_proportional})
NameExplanationData Type
in_network_diagram_layer

The network diagram to which the layout will be applied.

Diagram Layer
are_containers_preserved
(Optional)

Specifies how the algorithm will process containers.

  • PRESERVE_CONTAINERS The layout algorithm will execute on the top graph of the diagram so containers are preserved.
  • IGNORE_CONTAINERSThe layout algorithm will execute on both content and noncontent features in the diagram. This is the default.
Boolean
tree_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_RIGHT_TO_LEFTThe main line will be drawn as a horizontal line starting from the right and ending on the left.
  • FROM_BOTTOM_TO_TOPThe main line will be drawn as a vertical line starting from the bottom and ending at the top.
  • FROM_TOP_TO_BOTTOMThe main line will be drawn as a vertical line starting from the top and ending at the bottom.
String
branches_placement
(Optional)

Specifies how branches from the main line will be relatively placed with regard to its direction.

  • BOTH_SIDESBranches will be placed on both the left and right sides of the main line. This is the default.
  • LEFT_SIDEBranches will only be placed on the left side of the main line.
  • RIGHT_SIDEBranches will only be placed on the right side of the main line.
String
is_unit_absolute
(Optional)

Specifies how parameters representing distances will be interpreted.

  • ABSOLUTE_UNITThe layout algorithm will interpret any distance values as linear units.
  • PROPORTIONAL_UNITThe layout algorithm will interpret any distance values as relative units to an estimation of the average of the junction sizes in the current diagram extent. This is the default.
Boolean
perpendicular_absolute
(Optional)

The spacing between diagram junctions that are displayed along the axis perpendicular to the main line. The default is 2 in the diagram's coordinate system. This parameter can only be used with absolute units.

Linear Unit
perpendicular_proportional
(Optional)

The spacing between diagram junctions that are displayed along the axis perpendicular to the main line. The default is 2. This parameter can only be used with proportional units.

Double
along_absolute
(Optional)

The spacing between diagram junctions that are displayed along the main line, as well as the spacing between diagram junctions that are displayed along the axis parallel to the main line. This parameter can only be used with absolute units. The default is 2 in the units of the diagram's coordinate system.

Linear Unit
along_proportional
(Optional)

The spacing between diagram junctions that are displayed along the main line, as well as the spacing between diagram junctions that are displayed along the axis parallel to the main line. This parameter is used with proportional units. The default is 2.

Double
disjoined_graph_absolute
(Optional)

The minimum spacing that will separate features belonging to disjoined graphs when the diagram contains such graphs. This parameter is used with absolute units. The default is 4 in the units of the diagram's coordinate system.

Linear Unit
disjoined_graph_proportional
(Optional)

The minimum spacing that will separate features belonging to disjoined graphs when the diagram contains such graphs. This parameter is used with proportional units. The default is 4.

Double
are_edges_orthogonal
(Optional)

Specifies how diagram edges that are related to the tree branches will display.

Legacy:

This parameter is deprecated at ArcGIS Pro 2.9. It is systematically ignored regardless of its value when the edge_display_type parameter is specified. However, to maintain compatibility with ArcGIS Pro 2.1, it remains enabled when the edge_display_type parameter is not specified.

  • ORTHOGONAL_EDGESAll diagram edges related to the tree branches will display with right angles.
  • SLANTED_EDGESAll diagram edges related to the tree branches will not display with right angles. This is the default.
Boolean
breakpoint_position
(Optional)

The relative position of the break point that will be inserted along the diagram edges when Edge Display Type is set to Regular edges (edge_display_type = "REGULAR_EDGES" in Python) or Edge Display Type is set to Orthogonal edges (edge_display_type = "ORTHOGONAL_EDGES" in Python). It is a percentage between 0 and 100.

  • With a Break Point Relative Position (%) value of 0, the break point is positioned at the x-coordinate of the edge's from junction and at the y-coordinate of the edge's to junction for a horizontal tree. It is positioned at the y-coordinate of the edge's from junction and at the x-coordinate of the edge's to junction for a vertical tree.
  • With a Break Point Relative Position (%) value of 100, there is no break point inserted on the diagram edges; each diagram edge directly connects its from and to junctions.
  • With a Break Point Relative Position (%) value of N between 0 and 100, the break point is positioned at N% of the length of the [XY] segment, X being the x-coordinate of the edge's from junction and Y being the y-coordinate of the edge's to junction for a horizontal tree. It is positioned at N% of the length of the [YX] segment, Y being the y-coordinate of the edge's from junction and X being the x-coordinate of the edge's to junction for a vertical tree.

The relative position of the two inflection points that will be inserted along the diagram edges to compute the curved edges geometry when Edge Display Type is set to Curved edges (edge_display_type = "CURVED_EDGES" in Python). It is a percentage between 15 and 40. With a Break Point Relative Position (%) value of N between 15 and 40:

  • X being the x-coordinate of the edge's from junction and Y being the y-coordinate of the edge's to junction for a horizontal tree:
    • The first inflection point will be positioned at N% of the length of the [XY] segment.
    • The second inflection point will be positioned at (100 - N)% of the length of the [XY] segment.
  • Y being the y-coordinate of the edge's from junction and X being the x-coordinate of the edge's to junction for a vertical tree:
    • The first inflection point will be positioned at N% of the length of the [YX] segment.
    • The second inflection point will be positioned at (100 - N)% of the length of the [XY] segment.

Note:

The concept of the from and to junctions above is relative to the tree direction; it has nothing to do with the real topology of the edge feature or edge object in the network.

Double
edge_display_type
(Optional)

Specifies the type of display for the diagram edges related to the tree branches.

  • REGULAR_EDGESAll diagram edges related to the tree branches will not display with right angles. This is the default.
  • ORTHOGONAL_EDGESAll diagram edges related to the tree branches will display with right angles.
  • CURVED_EDGESAll diagram edges related to the tree branches will be curved.
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 when executing 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 its execution exceeds the service default time-out value of 600 seconds. This is the default.
Boolean
offset_absolute
(Optional)

The offset that will be used to separate overlapping segments when is_unit_absolute = "ABSOLUTE_UNIT" and edge_display_type = "ORTHOGONAL_EDGES". The value cannot exceed 10 percent of the smallest value specified for the other spacing parameters. The default is 0.

Linear Unit
offset_proportional
(Optional)

The offset that will be used to separate overlapping segments when is_unit_absolute = "PROPORTIONAL_UNIT" and edge_display_type = "ORTHOGONAL_EDGES". It is a double value that cannot exceed 10 percent of the smallest value specified for the other spacing parameters. The default is 0.

Double

Derived Output

NameExplanationData Type
out_network_diagram_layer

The updated network diagram layer.

Diagram Layer

Code sample

ApplyMainlineTreeLayout example (Python window)

Apply the Mainline Tree Layout algorithm to the diagram called Temporary Diagram.

import arcpy

arcpy.ApplyMainlineTreeLayout_nd("Temporary Diagram", "PRESERVE_CONTAINERS", 
                                 "FROM_LEFT_TO_RIGHT", "BOTH_SIDES", 
                                 "ABSOLUTE_UNIT", "100 Feet", "" , "100 Feet", 
                                 "", "200 Feet", "", "", 30, "ORTHOGONAL_EDGES", 
                                 "RUN_SYNCHRONOUSLY", "10 Feet", "")

Environments

This tool does not use any geoprocessing environments.

Licensing information

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

Related topics