Skip to content

Associations enable the modeling of connectivity, containment, and structure attachment between non-spatial and non-coincident network features. The following table describes the types of relationships between two utility network elements:

AssociationDescriptionGeometry supported
ConnectivityModels the connectivity between two junctions that don't have geometric coincidence (are not in the same x, y and z location). A transformer may be connected to a fuse, for example.Yes
Structural attachmentModels equipment attached to structures. A transformer bank may be attached to a pole, for example.Yes
ContainmentModels assets that contain other assets. A vault may contain valves and pipes, for example.No
Utility network associations
Use dark colors for code blocksCopy
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
    // Get the elements associated (by containment) with a specified utility element.
    final utilityAssociations = await _utilityNetwork.getAssociations(
      element: containerElement,
      type: UtilityAssociationType.containment,
    );
    // Iterate all associations for this element.
    for (final association in utilityAssociations) {
      // Get the first ("from") and second ("to") elements in the association.
      final fromElement = association.fromElement;
      final toElement = association.toElement;
    }

You can also provide an envelope to find all valid associations within the specified extent.

The following shows a graphics overlay to display all associations within the map extent using a unique symbol for each association type.

Use dark colors for code blocksCopy
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
    // Get the current viewpoint's extent.
    final viewpoint =
        _mapViewController.getCurrentViewpoint(ViewpointType.boundingGeometry);

    if (viewpoint == null) return;

    final extent = viewpoint.targetGeometry as Envelope;

    // Create symbols for structural attachment and connectivity associations.
    final attachmentSymbol = SimpleLineSymbol(
      style: SimpleLineSymbolStyle.dot,
      color: Colors.green,
      width: 5,
    );
    final connectivitySymbol = SimpleLineSymbol(
      style: SimpleLineSymbolStyle.dot,
      color: Colors.red,
      width: 5,
    );

    // Create unique value renderer for the associations and apply it to the graphics overlay.
    final attachmentValue = UniqueValue(
      description: 'Attachment',
      symbol: attachmentSymbol,
      values: [UtilityAssociationType.attachment.name],
    );
    final connectivityValue = UniqueValue(
      description: 'Connectivity',
      symbol: connectivitySymbol,
      values: [UtilityAssociationType.connectivity.name],
    );
    _graphicsOverlay.renderer = UniqueValueRenderer(
      fieldNames: ['AssociationType'],
      uniqueValues: [attachmentValue, connectivityValue],
    );

    // Get all of the associations in the current extent.
    try {
      final utilityAssociations =
          await _utilityNetwork.getAssociationsWithEnvelope(extent);

      for (final utilityAssociation in utilityAssociations) {
        // If it's not a containment relationship, add a graphic for the association.
        if (utilityAssociation.associationType !=
            UtilityAssociationType.containment) {
          final graphic = Graphic(
            geometry: utilityAssociation.geometry,
            attributes: {
              'GlobalId': utilityAssociation.globalId,
              'AssociationType': utilityAssociation.associationType.name,
            },
          );
          _graphicsOverlay.graphics.add(graphic);
        }
      }
    } catch (e) {
      // Handle error (show error message, etc.)
      debugPrint('Error getting associations: $e');
    }

Specifying a utility element will return all its associations unless the utility element's terminal has been set, which limits the connectivity associations returned.

Specifying an extent will return all its connectivity or structural attachment associations with geometry. The geometry value (polyline) represents the connection relationship between a from element and a to element. You can use the geometry to visualize the association as a graphic in the map.

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