ArcGIS Blog

Data Management

ArcGIS Pro

Export Network Diagrams

By Network Diagrams Team

Introduction

You can export network diagrams in a variety of file formats. There are two export types: network diagram map or layout exports, and network diagram content exports. Which one you choose depends on how you want to share your diagrams with others.

Export a diagram map or a layout page with an added diagram map

Exporting a diagram map or exporting a layout page with an added diagram map allows you to share your diagram in various vector formats (AIX, EMF, EPS, PDF, SVG, and SVGZ) or raster formats (BMP, JPEG, PNG, TIFF, TGA, and GIF).

Export diagram maps

In ArcGIS Pro, diagrams open in a diagram map view that you can export like any open standard map view. This diagram export workflow starts from the Share tab where you can click Export Map to open the Export Map pane. This pane allows you to specify the File Type format for the exported diagram map and adjust parameters. When you are finished,  you can click Export at the bottom of the pane.

Export diagram map workflow
Using the Export Map command to export diagrams

Learn more about the Export Map pane

Export page layouts with added diagram maps

To share your network diagram work as a printed map, or poster, it is recommended that you make a page layout. Any diagram map you create or open as a standard map can be added to a page layout. To create a new page layout, click the Insert tab and select a paper size from the New Layout gallery. Next, create a map frame in this page layout for an open diagram map view by selecting this map view in the Map Frame list. Then click and drag on the layout page to create the map frame. To refine and enrich your page layout, you can then adjust the map frame size, add a legend, and so on. When you are ready to export, click the Share tab and click Export Layout to open the Export Layout pane. Select the File Type format for the exported active page layout, adjust parameters, and click Export at the bottom of the pane.

Export layout with added diagram maps workflow
Using the Export Layout command to export diagrams

Benefits of exporting in PDF format

In the Export Map or Export Layout dialog box, when exporting in PDF format, you can select PDF Layers and Feature attributes in the PDF Settings section.

PDF Layers and Feature Attributes option in the Export Map dialog
PDF Layers and Feature Attributes option in the Export Map dialog

This advanced setting allows you to export diagram sub layers as separate layers and include visible attributes from the diagram feature classes in the output PDF document. You can then view and manage these exported layers and feature attributes in supported PDF readers such as Adobe Acrobat Reader, as shown below:

 

View and manage exported layers and feature attributes in the exported diagram PDF document
View and manage exported layers and feature attributes in the exported diagram PDF document

Export network diagram contents

Exporting network diagram contents allows you to export diagram features in a format you can use as input for other applications. You can export network diagrams to JSON files  with the Export Diagram Content geoprocessing tool. You can also develop a Python script or an ArcGIS Pro add-in command to export network diagram contents into feature classes.

Export diagrams to JSON files

The Export Diagram Content geoprocessing tool allows you to export network diagram content as a simple-format JSON file that details all the features referenced in your network diagram. The resulting JSON file can then be used for various purposes, such as data control, calculation, or analysis. It can also be used as input for external systems.

The export operation can be configured to export the following information:

  • Diagram properties—For example, diagram statistics, diagram creation and update dates, and so on.
  • Each diagram feature can be exported with the following:
    • Geometry
    • Connectivity
    • Containment relations
    • Attributes of its associated network feature.
    • List of the network elements it aggregates.

When exporting attributes or aggregations, you can optionally export coded domain and subtype values as string descriptions rather than raw values for any exported attributes with coded domain values.

Learn more about the Export Diagram Content output JSON file

Export diagrams to feature classes

The diagram feature classes are private and cannot be easily accessed and queried by users. However, with ArcGIS Pro SDK for .NET API or ArcGIS API for Python, you can develop custom code to export your network diagrams to feature classes.

Develop an ArcGIS Pro add-in command

Using Network Diagrams ArcGIS Pro SDK for .NET API, you can develop a custom ArcGIS Pro add-in command to export network diagram contents to feature classes. You can download such an add-in command code sample from the ArcGIS Pro SDK Community Samples GitHub repository. This generic code sample called ExportDiagramToFeatureClasses performs any network diagram related to any utility or trace network dataset. It applies to any network diagram present in an active diagram map and exports its content into a set of feature classes in a feature dataset in a local geodatabase (File or Mobile). The output feature dataset can then be added to a map, shared with others, and so on. This add-in also allows you to export the diagram aggregations into a specific table in the output geodatabase, and it allows you to add the resulting exported features to a new empty map under feature layers built with the same layer properties as under the original network diagram layer.

Python Scripting

To export network diagram contents to feature classes, you can also code and run a Python script.

The sample Python script code below shows how you can export any stored diagram related to a given utility network or trace network into an output geodatabase. In the specified output geodatabase, it creates a feature dataset with a name corresponding to the diagram name to export. Then, it runs the MakeDiagramLayer command to export the stored diagram as a group layer with its related sublayers. Then, it loops on each sublayer to retain only CIMFeatureLayers and bypass all CIMSubtypeGroupLayers. At the end, it converts  all the retrieved CIMFeatureLayers to geodatabase feature classes in the feature dataset that was created in the output geodatabase.

# Import system modules
import arcpy

# Initialize variables
network = "C:/UNDatabaseFolder/UNDatabaseName.gdb/UNFeatureDatasetName/UNName"
export_fgdb = "C:/UNDatabaseFolder/OutputDatabaseName.gdb"
storedDiagramName = "DiagramNameToExport"

export_fgdbFeatureDataset = export_fgdb + "/" + storedDiagramName

# Main code
arcpy.management.CreateFeatureDataset(export_fgdb, storedDiagramName) 

groupLayer = arcpy.nd.MakeDiagramLayer(network, storedDiagramName, "GroupLayer1", 'ADD_SUBLAYERS')[0]

featureLayers = list()
for layer in groupLayer.listLayers() + groupLayer.listTables():
    getdef = layer.getDefinition('V3')
    if type(getdef) is arcpy.cim.CIMVectorLayers.CIMFeatureLayer:
        featureLayers.append(layer)

arcpy.conversion.FeatureClassToGeodatabase(featureLayers, export_fgdbFeatureDataset)

print('Export diagram feature layers completed')

NOTE: The Python script above is compatible with ArcGIS Pro 3.4 and later, in which the MakeDiagramLayer command supports the new sublayers_option parameter.

Conclusion

You can now export your network diagrams in various ways and thus share your network diagram work with others, whether internal or external to your organization.

Share this article

Subscribe
Notify of
0 Comments
Oldest
Newest
Inline Feedbacks
View all comments