Create graphics for utility associations in a utility network.

Use case
Visualizing utility associations can help you to better understand trace results and the topology of your utility network. For example, connectivity associations allow you to model connectivity between two junctions that don’t have geometric coincidence (are not in the same location); structural attachment associations allow you to model equipment that may be attached to structures; and containment associations allow you to model features contained within other features.
How to use the sample
Pan and zoom around the map. Observe graphics that show utility associations between junctions.
How it works
- Create and load a
Mapwith a web map item URL that contains aUtilityNetwork. - Get and load the first
UtilityNetworkfrom the web map. - Create a
GraphicsOverlayfor the utility associations. - When the sample is opened and every time the viewpoint changes, do the following steps.
- Get the extent of the map view’s target geometry by using
MapView.onViewpointChanged(kind:). - Get the associations that are within the current extent using
UtilityNetwork.associations(forExtent:). - Get the
UtilityAssociation.Kindfor each association. - Create a
Graphicusing theGeometryproperty of the association and a preferred symbol. - Add the graphic to the graphics overlay.
Relevant API
- GraphicsOverlay
- ServiceGeodatabase
- UtilityAssociation
- UtilityAssociation.Kind
- UtilityNetwork
About the data
The Naperville Electric Map web map contains a utility network used to run the subnetwork-based trace in this sample. Authentication is required and handled within the sample code.
Tags
associating, association, attachment, connectivity, containment, relationships