Store Diagram (Network Diagram)

Summary

Stores a temporary network diagram in the database. Access rights and tags can be assigned to control security and searchability of the diagram.

Learn more about storing network diagrams

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.

  • By default, a new network diagram is a temporary diagram that will be discarded when the map in which it is referenced is closed. Storing a temporary diagram allows the diagram to be retained in the database to reopen at another time.

  • To avoid unnecessarily increasing the database size and making future processes—such as copying datasets or upgrading or migrating databases—take longer, only store diagrams when necessary. Examples are storing diagrams with a refined layout that you don't want to lose or storing diagrams to share.

  • The access level applies only to stored diagrams; temporary diagrams are not available in the database and cannot be accessed by others. The only exception is when the project with the temporary diagram is saved and distributed to others.

  • Tags can be separated with the number sign (#) for efficient searches using the Find Diagrams pane.

  • Attempting to store an inconsistent diagram will fail. In this case, use the Update Diagram tool to update the diagram so it becomes consistent before storing.

  • Attempting to store a diagram with unsaved edits will fail. Any edits must be saved prior to storing a diagram to ensure that the diagram reflects the last save moment of the network topology in the database.

  • Attempting to store a diagram based on a template that has the diagram storage capability disabled will fail. Diagram storage can be blocked at the diagram template level using the Alter Diagram Template tool so database space is not wasted on stored diagrams that are not relevant.

  • When working with a utility network or trace network in a file or mobile geodatabase, diagrams can be stored with Public access rights, even without being connected to an ArcGIS Enterprise portal. However, you must be connected to store diagrams with Protected or Private access rights.

Parameters

LabelExplanationData Type
Input Network Diagram Layer

The temporary network diagram layer to be stored.

Diagram Layer
Network Diagram Name

The name of the output network diagram.

Diagram Layer
Network Diagram Access Rights
(Optional)

Specifies the access right level of the input diagram.

  • PublicOther users will have full access to the diagram; everyone can see, edit, update, and overwrite the diagram. However, no one except the diagram owner and the portal utility network owner—in the case of diagrams related to a utility network in an enterprise geodatabase—can use the Alter Diagram Properties tool to change the access right level. This is the default.
  • ProtectedOther users will have read-only access to the diagram. They cannot edit, update, or overwrite the diagram.
  • Private Other users will not have access to the diagram. The corresponding diagram item will be hidden from other users in the Find Diagrams pane.
String
Tags (optional)
(Optional)

Tags help with querying the stored diagram using the Find Diagrams pane.

Use the # character to separate each tag and aid in efficient diagram searches.

String

arcpy.nd.StoreDiagram(in_network_diagram_layer, out_name, {access_right_type}, {tags})
NameExplanationData Type
in_network_diagram_layer

The temporary network diagram layer to be stored.

Diagram Layer
out_name

The name of the output network diagram.

Diagram Layer
access_right_type
(Optional)

Specifies the access right level of the input diagram.

  • PUBLICOther users will have full access to the diagram; everyone can see, edit, update, and overwrite the diagram. However, no one except the diagram owner and the portal utility network owner—in the case of diagrams related to a utility network in an enterprise geodatabase—can use the Alter Diagram Properties tool to change the access right level. This is the default.
  • PROTECTEDOther users will have read-only access to the diagram. They cannot edit, update, or overwrite the diagram.
  • PRIVATE Other users will not have access to the diagram. The corresponding diagram item will be hidden from other users in the Find Diagrams pane.
String
tags
(Optional)

Tags help with querying the stored diagram using the Find Diagrams pane.

Use the # character to separate each tag and aid in efficient diagram searches.

String

Code sample

StoreDiagram example (stand-alone example)

The following stand-alone script demonstrates how to create a network diagram and store it in the database.

# Name: GenerateAndStoreADiagram.py
# Description:  Generate and store a diagram from a set of features based on a feature class and an attribute query.

# Import system modules
import arcpy

# Initialize variables
input_network = "https://cezembre.esri.com/server/rest/services/Naperville_Electric_SQL/FeatureServer/0"
input_fc = "https://cezembre.esri.com/server/rest/services/Naperville_Electric_SQL/FeatureServer/7"
sql_expression = "SUBNETWORKNAME='RMT003'"
template_name = "Basic"
output_diagram_name = "MyBasicRMT003Diagram"

# Set overwrite option
arcpy.env.overwriteOutput = True

# Make a layer from features in the feature class filtered out using an attribute query
FeatureLayer = arcpy.MakeFeatureLayer_management(input_fc, "built_featurelayer", 
                                                 sql_expression)

# Create a diagram based on a given template name from those features
result = arcpy.CreateDiagram_nd(input_network, template_name, 
                                "built_featurelayer")
diagram_name = result[1]
arcpy.MakeDiagramLayer_nd(input_network, diagram_name, 
                          "built_diagramlayer")

# Store the resulting diagram in the database. 
arcpy.StoreDiagram_nd("built_diagramlayer", output_diagram_name)

Environments

This tool does not use any geoprocessing environments.

Licensing information

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

Related topics