With the ArcGIS Maps SDK for JavaScript, you can display a utility network, view associations, and configure traces in your applications.
The UtilityNetwork contains metadata such as domain network names and shared named trace configurations, along with methods to obtain tier names and terminal configurations. See What is a utility network? for more information on utility networks.
NoteUtility Network widgets and components do not support proxied feature services or feature services that utilize stored credentials.
Load the WebMapA UtilityNetwork can be obtained from a WebMap containing a utility network layer. See Publish a utility network layer to for more information on configuring and publishing a utility network layer. The first step is to load the webmap. The following code snippet demonstrates how to load a webmap hosted on ArcGIS Enterprise.
Use dark colors for code blocks Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const [WebMap, MapView, esriConfig] = await $arcgis.import([
"@arcgis/core/WebMap.js",
"@arcgis/core/views/MapView.js",
"@arcgis/core/config.js",
]);
// set the hostname to the portal instance
esriConfig.portalUrl = "https://myHostName.domain.com/arcgis";
// initialize the WebMap with the webmap id
const webMap = new WebMap({
portalItem: {
id: "MyWebmapId",
},
});
const view = new MapView({
map: webMap,
});
Load the utility network
The webmap must finish loading before accessing the utility network from the WebMap.utilityNetworks property. Use the load() method to access the UtilityNetwork and its properties. The following document may help as it provides detailed Object Model Diagrams (OMDs) of the Utility Network classes, interfaces and enumerations exposed in the ArcGIS Maps SDK for JavaScript: Utility Network OMD
Expand
Use dark colors for code blocks Copy1
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
webMap.when(async () => {
// check if webMap contains utility networks
if (webMap.utilityNetworks.length > 0) {
// assign the utility network at index 0
utilityNetwork = webMap.utilityNetworks.getItemAt(0);
// trigger the loading of the UtilityNetwork instance
await utilityNetwork.load();
}
});
Additional topics View associations
Learn how to obtain and visualize associations.
Trace a utility networkLearn how to configure trace configurations and run shared named trace configurations programmatically or with a widget.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4