Get associated utility elements. Associations let you model connectivity between points that are not coincident, the structural support of assets, and features encased within other features. For details, see the Get associated utility elements section in the Trace a utility network topic.
To create, edit, manage, and configure a utility network, use ArcGIS Pro. Create it within an enterprise geodatabase, configure it, and publish it as a feature service so that it can be used in your app. For more information on creating utility networks, see in the utility network creation and configuration in the ArcGIS Pro documentation.
Every utility network contains at least one domain network and may contain tiers, subnetworks, and subnetwork controllers. The properties of these components define the characteristics of the subnetworks and drive tracing operations. In your app, you can access schema information about these components from a utility network definition object.
For information about the logical structure of a utility network, see Structure of a utility network in ArcGIS Pro's help. Note that feature classes in ArcGIS Pro are similar to feature tables in this API.
Display a utility network
You can display and share a complete utility network using a web map. You should include at most one feature layer for every feature table in the utility network.
As an alternative to using a web map, you can create your own map programmatically, making use of subtype feature layers (known as subtype group layers in ArcGIS Pro and in the web map). Subtype feature layers allow symbology and other layer properties to be set on a per-subtype basis. Utility networks make extensive use of subtypes (referred to as asset groups within a utility network). For example, a device feature table from an electric utility network would include subtypes for fuses, switches, transformers, and other kinds of equipment.
You can use display filters to show and hide features inside containers, replicating the functionality available in ArcGIS Pro to show or hide containment association content. You can also use display filters to ensure that critical network features are returned in a trace result even if they are removed from view to simplify the display. For more information, see display filters in feature layers.
Take a utility network offline
Starting with version 100.11.0, you can take certain utility network information offline. Associations, which are used to describe containment, structural attachment, and connection between features with non-coincident geometry, can be queried and displayed with offline data. Simple edits can also be made to utility network features while offline, and synchronized back to ArcGIS Enterprise.
The following code takes a web map offline that contains a utility network. The utility network tables are automatically synced with a map when a utility network is detected inside.
Expand
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
funcinitializeOfflineMapTask()async {
do {
tryawait map.load()
// Creates the offline map task with the web map. offlineMapTask =OfflineMapTask(onlineMap: map)
await makeGenerateOfflineMapJob()
} catch {
print("Error loading map.")
}
}
funcmakeGenerateOfflineMapJob()async {
let areaOfInterest =Envelope(xMin: -13049000, yMin: 3861000, xMax: -13048000, yMax: 3861500, spatialReference: map.spatialReference)
// Creates the default parameters for the offline map task.guardlet parameters =await makeGenerateParameters(areaOfInterest: areaOfInterest) else { return }
// Creates the generate offline map job based on the parameters.guardlet offlineMapTask = offlineMapTask else { return }
generateOfflineMapJob = offlineMapTask.makeGenerateOfflineMapJob(
parameters: parameters,
downloadDirectory: makeTemporaryDirectory()
)
// Starts the offline map job. generateOfflineMapJob.start()
do {
// Awaits the output of the job.let output =tryawait generateOfflineMapJob.output
// Gets the first utility network in the offline map.let utilityNetwork = output.offlineMap.utilityNetworks.first
tryawait utilityNetwork?.load()
} catch {
print("Error getting first utility network.")
}
}
funcmakeGenerateParameters(areaOfInterest: Envelope)async -> GenerateOfflineMapParameters? {
do {
// Retrieves the default offline map parameters for an area of interest.let parameters =tryawait offlineMapTask?.makeDefaultGenerateOfflineMapParameters(areaOfInterest: areaOfInterest)
parameters?.includesBasemap =falsereturn parameters
} catch {
print("Error generating parameters.")
returnnil }
}
Expand
The following code takes a utility network offline using a service geodatabase. The utility network tables only get synced when the sync mode in the generate geodatabase parameters is set to sync system tables.
Expand
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
funcinitializeGeodatabaseSyncTask()async {
do {
tryawait map.load()
// The URL must be to a feature service hosted on ArcGIS Enterprise 10.9 or later.let featureServiceURL =URL(string: "https://myserver.esri.com/server/rest/services/SDKTest/FeatureServer")! geodatabaseSyncTask =GeodatabaseSyncTask(url: featureServiceURL)
await makeGenerateGeodatabaseJob()
} catch {
print("Error initializing geodatabase sync task.")
}
}
funcmakeGenerateGeodatabaseJob()async {
// Makes the default parameters with the area of interest.let areaOfInterest =Envelope(xMin: 473240, yMin: 3600000, xMax: 475000, yMax: 3605000, spatialReference: .init(wkid: WKID(26911)!))
guardlet parameters =await makeDefaultParameters(areaOfInterest: areaOfInterest) else { return }
parameters.utilityNetworkSyncMode = .syncSystemTables
// Creates a temporary directory to store the downloaded geodatabase.let downloadDirectory = makeTemporaryDirectory()
generateGeodatabaseJob = geodatabaseSyncTask?.makeGenerateGeodatabaseJob(parameters: parameters, downloadFileURL: downloadDirectory)
// Starts the geodatabase. generateGeodatabaseJob.start()
do {
// Prints the geodatabase's first utility network.let output =tryawait generateGeodatabaseJob.output
guardlet utilityNetwork = output.utilityNetworks.first else { return }
print(utilityNetwork.name)
} catch {
print("Error getting first utility network.")
return }
}
// Makes the default parameters with the area of interest.funcmakeDefaultParameters(areaOfInterest: Envelope)async -> GenerateGeodatabaseParameters? {
do {
returntryawait geodatabaseSyncTask?.makeDefaultGenerateGeodatabaseParameters(extent: areaOfInterest)
} catch {
returnnil }
}