Work with utility elements

An array of analysis and tracing options usually begin with or include a utility element in the result. This element corresponds to a network feature or object that contains additional information such as a terminal or fraction along value that affects the analysis. For example, the utility element's terminal may limit the number of connectivity associations or change the direction of a trace, while its fraction along value may return a partial geometry from a trace.

This utility element may be created from a feature or asset type with a global id. The feature may be a result of a query or identify operation on a layer or table that is part of the utility network.

Utility element from a feature

You may query for a specific feature using any of its fields or geometry or interactively identify a feature in a map view. When using identify, the feature may be found in the GeoElement list immediately under IdentifyLayerResult when part of a FeatureLayer or from SublayerResults when part of a SubtypeFeatureLayer.

Query using a unique ID
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
var query = new QueryParameters(){ WhereClause = "GlobalId like '{D353C10C-E617-4618-BDD0-B48EDB822D07}'"};
var queryResult = await table.QueryFeaturesAsync(query);
var feature = queryResult.FirstOrDefault() as ArcGISFeature;
Identify a feature from a tap on the map
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
var identifyLayerResults = await MyMapView.IdentifyLayersAsync(e.Position, 5, false);
ArcGISFeature? feature = null;
foreach (var layerResult in identifyLayerResults)
{
    if (layerResult.LayerContent is SubtypeFeatureLayer)
    {
        foreach (var subLayerResult in layerResult.SublayerResults)
        {
            if (feature is not null)
                break;
            foreach (ArcGISFeature geoElement in subLayerResult.GeoElements)
            {
                if (feature is not null)
                    break;
                feature =  geoElement;
            }
        }
    }
    else if (layerResult.LayerContent is FeatureLayer)
    {
        foreach (ArcGISFeature geoElement in layerResult.GeoElements)
        {
            if (feature is not null)
                break;
            feature = geoElement;
        }
    }
}
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
await feature.LoadAsync();
var element = utilityNetwork.CreateElement(feature);

Utility element from an asset type

An asset type can come from another utility element or be derived from a feature in the utility network, except from a subnet line table that does not have an asset type. You can use the feature's table name to get its network source. Use the network source and the feature's subtype to get its asset group. From the asset group, you can select an asset type by name or code.

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
var assetType = otherElement.AssetType;
var element = utilityNetwork.CreateElement(assetType, globalId);

var tableName = feature.FeatureTable?.TableName;
var networkSource = utilityNetwork.Definition?.GetNetworkSource(tableName);

var subtypeName = feature.GetFeatureSubtype()?.Name;
var assetGroup = networkSource?.GetAssetGroup(subtypeName);

var assetTypeCode = (int)feature.Attributes["ASSETTYPE"];
assetType = assetGroup?.AssetTypes?.FirstOrDefault(t => t.Code == assetTypeCode);

networkSource = utilityNetwork.Definition?.GetNetworkSource("Electric Distribution Device");
assetGroup = networkSource?.GetAssetGroup("Service Point");
assetType = assetGroup?.GetAssetType("Single Phase Low Voltage Meter");
element = utilityNetwork.CreateElement(assetType, globalId);

Utility element properties

A terminal is required when a UtilityElement that supports more than one terminal is used in a trace and optional when used to get associations. Terminals impact traces and connectivity 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
if (element.AssetType.TerminalConfiguration?.Terminals.Count > 1)
  element.Terminal = element.AssetType.TerminalConfiguration?.Terminals?.FirstOrDefault();

If the feature represents a line, you can optionally specify a location along the line to use as a trace location. This value is a percentage of the length of the line, beginning from the line's 'from' point.

Use UtilityElement.FractionAlongEdge to define the location of the point along the line.

The following example uses the GeometryEngine to get the fraction of a tap location along the line.

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
if (element.NetworkSource?.SourceType == UtilityNetworkSourceType.Edge && feature.Geometry is Polyline line)
{
    if (line.HasZ && GeometryEngine.RemoveZ(line) is Polyline line2) {
        line = line2;
    }
    if (mapPoint.SpatialReference != null &&
        line.SpatialReference != mapPoint.SpatialReference &&
        GeometryEngine.Project(line, mapPoint.SpatialReference) is Polyline projectedLine) {
        line = projectedLine;
    }
    var percentAlong = GeometryEngine.FractionAlong(line, mapPoint, double.NaN);
    if (!double.IsNaN(percentAlong)) {
        element.FractionAlongEdge = percentAlong;
    }
}

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