Display utility associations

View inQMLC++
View on GitHub
Sample viewer app

Create graphics for utility associations in a utility network.

screenshot

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

  1. Create and load a UtilityNetwork with a feature service URL.
  2. Add a FeatureLayer to the map for every UtilityNetworkSource of type Edge or Junction.
  3. Create a GraphicsOverlay for the utility associations.
  4. Add connection for the ViewpointChanged signal of the MapView.
  5. When the sample starts and every time the viewpoint changes, do the following steps.
  6. Get the geometry of the mapview's extent using currentViewpoint(ViewpointType::BoundingGeometry).targetGeometry.extent.
  7. Get the associations that are within the current extent using associations(extent).
  8. Get the UtilityAssociationType for each association.
  9. Create a Graphic using the Geometry property of the association and a preferred symbol.
  10. Add the graphic to the graphics overlay.

Relevant API

  • GraphicsOverlay
  • UtilityAssociation
  • UtilityAssociationType
  • UtilityNetwork

About the data

The feature service in this sample represents an electric network in Naperville, Illinois, which contains a utility network used to run the subnetwork-based trace.

Additional information

Using utility network on ArcGIS Enterprise 10.8 requires an ArcGIS Enterprise member account licensed with the Utility Network user type extension. Please refer to the utility network services documentation.

Credentials:

  • Username: viewer01
  • Password: I68VGU^nMurF

Tags

associating, association, attachment, connectivity, containment, relationships

Sample Code

DisplayUtilityAssociations.qmlDisplayUtilityAssociations.cppDisplayUtilityAssociations.hSymbolImageProvider.cppSymbolImageProvider.h
                                                                                  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// [WriteFile Name=DisplayUtilityAssociations, Category=UtilityNetwork]
// [Legal]
// Copyright 2020 Esri.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// [Legal]

import QtQuick 2.6
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import Esri.Samples 1.0

Item {
    // add a mapView component
    MapView {
        id: view
        anchors.fill: parent

        Control {
            background: Rectangle {
                border.color: "black"
                border.width: 1
            }
            padding: 5
            visible: model.attachmentSymbolUrl !== "" && model.connectivitySymbolUrl !== ""
            anchors {
                top: parent.top
                left: parent.left
                margins: 20
            }

            contentItem: GridLayout {
                id: grid
                columns: 2
                anchors.horizontalCenter: parent.horizontalCenter
                Layout.fillWidth: true
                Label {
                    text: "Utility association types"
                    Layout.alignment: Qt.AlignHCenter
                    Layout.fillWidth: true
                    Layout.columnSpan: 2
                }

                Image {
                    id: attachmentImage
                    source: model.attachmentSymbolUrl
                    fillMode: Image.PreserveAspectFit
                }
                Label {
                    id: attachmentLabel
                    text: "Attachment symbol"
                    visible: model.attachmentSymbolUrl !== "" && model.connectivitySymbolUrl !== ""
                }

                Image {
                    id: connectivityImage
                    source: model.connectivitySymbolUrl
                }
                Label {
                    id: connectivityLabel
                    text: "Connectivity symbol"
                    visible: model.attachmentSymbolUrl !== "" && model.connectivitySymbolUrl !== ""
                }
            }
        }
    }

    // Declare the C++ instance which creates the scene etc. and supply the view
    DisplayUtilityAssociationsSample {
        id: model
        mapView: view
    }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.