You can display and share a complete utility network A utility network is a feature service that represents a utility system, such as water, gas, or electricity. A utility network provides the capabilities to visualize, edit, and analyze utility assets and data. Learn more using a web map A web map is a map stored as a JSON object that defines properties such as the basemap layer, data layers, layer styles, and pop-up styles. Its JSON structure is defined by the web map specification. Learn more or mobile geodatabase A mobile geodatabase (.geodatabase) is a spatial data storage format in a single file on disk that can store, query, and manage spatial and nonspatial data. In applications built with the ArcGIS Maps SDKs for Native Apps, mobile geodatabases can be used in offline workflows when taking maps and features offline from services or in desktop-based scenarios as standalone mobile geodatabases from ArcGIS Pro. Learn more . You should include at most one feature layer A feature layer (client-side) is a data layer that can access and display features from a feature service that has the same type of geometry and attribute fields. Learn more for every feature table A feature table is a database table of a single geometry type, such as point, line, or polygon, that stores features that conform to the schema of the table. Learn more in the utility network.

You can also create a map programmatically, making use of subtype feature layers A subtype feature layer is a feature layer that allows symbology and other layer properties to be set on a per-subtype basis. Learn more (known as subtype group layers in ArcGIS Pro ArcGIS Pro is a professional desktop GIS application that can explore, visualize, analyze, and manage 2D and 3D data. Learn more and in the web map). Subtype feature layers allow you to set symbology and other layer A layer is a reference to a collection of geographic data that is used to access and display data. The data for layers are typically provided by the basemap layer service and data services. Learn more properties on a per-subtype basis. Utility networks make extensive use of subtypes (referred to as asset groups An asset group is the main classification of a utility element. Each asset group is then divided into a collection of asset types. Learn more 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. For more information, see the Set visibility of subtype sublayer sample.

You can use display filters to show and hide features A feature is a single record, also known as a row, that represents a real-world entity. It typically contains a geometry (point, multipoint, polyline, or polygon) and attributes but it can also contain just attributes. Learn more 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 A trace is an action that analyzes the paths in a utility network and returns features based on connectivity or traversability from the specified starting points. Learn more result even if they are removed from the view to simplify the display. For more information, see display filters in feature layers.

Access a utility network

Utility networks are implemented as network controller datasets. These datasets contain a network’s feature tables A feature table is a database table of a single geometry type, such as point, line, or polygon, that stores features that conform to the schema of the table. Learn more along with the network’s domains, sources, tiers A tier is either 1) a level in the MVC programming pattern; 2) in a utility network, a tier is part of the architectural structure of a subnetwork that helps to define its properties and restrictions. Learn more , assets, terminals A terminal represents logical ports, entries, or exit locations on a single device or junction object within a utility network. Each port can flow in or out. Each device can contain many terminals, all of which can be interconnected. Learn more , rules, and associations An association is a relationship between two elements that is reflected in a utility network topology. Learn more . A utility network is accessible from a feature service A feature service is a data service that provides access to spatial and non-spatial data in feature layers, feature layer views, and tables. Learn more geodatabase or a mobile geodatabase A mobile geodatabase (.geodatabase) is a spatial data storage format in a single file on disk that can store, query, and manage spatial and nonspatial data. In applications built with the ArcGIS Maps SDKs for Native Apps, mobile geodatabases can be used in offline workflows when taking maps and features offline from services or in desktop-based scenarios as standalone mobile geodatabases from ArcGIS Pro. Learn more .

You can display and share a complete utility network with a user via a web map A web map is a map stored as a JSON object that defines properties such as the basemap layer, data layers, layer styles, and pop-up styles. Its JSON structure is defined by the web map specification. Learn more if the map includes one feature layer A feature layer (client-side) is a data layer that can access and display features from a feature service that has the same type of geometry and attribute fields. Learn more for every network source A network source is a feature table whose features comprise one of a utility network's datasets. Learn more .

Diagram of objects loaded when loading a utility network with a map with layers for all network sources.

A UtilityNetwork object in Native Maps SDKs can be created from an online or an offline Offline is the state of having no network connection and applications cannot access ArcGIS Online or ArcGIS Enterprise. Learn more source.

These sources provide access to the topological network in the utility network. For example, you can provide a map that contains a subset of the feature layers A feature layer (client-side) is a data layer that can access and display features from a feature service that has the same type of geometry and attribute fields. Learn more for a specific workflow; any tracing is performed using the full topological network provided by the feature service A feature service is a data service that provides access to spatial and non-spatial data in feature layers, feature layer views, and tables. Learn more . To add additional utility network layers, you can create them from the individual network sources A network source is a feature table whose features comprise one of a utility network's datasets. Learn more as required. You can also access a utility network and run a trace A trace is an action that analyzes the paths in a utility network and returns features based on connectivity or traversability from the specified starting points. Learn more completely without a map, just provide the feature service A feature service is a data service that provides access to spatial and non-spatial data in feature layers, feature layer views, and tables. Learn more URL when you create the utility network or load a utility network from a mobile geodatabase A mobile geodatabase (.geodatabase) is a spatial data storage format in a single file on disk that can store, query, and manage spatial and nonspatial data. In applications built with the ArcGIS Maps SDKs for Native Apps, mobile geodatabases can be used in offline workflows when taking maps and features offline from services or in desktop-based scenarios as standalone mobile geodatabases from ArcGIS Pro. Learn more .

Utility Network version 2 and later is supported. This is provided from ArcGIS Pro ArcGIS Pro is a professional desktop GIS application that can explore, visualize, analyze, and manage 2D and 3D data. Learn more 2.2 and later. For details see utility network upgrade history.

Access a utility network from an online source

Online sources include a URL to a feature service A feature service is a data service that provides access to spatial and non-spatial data in feature layers, feature layer views, and tables. Learn more or a feature service portal item An item, also known as a content item, is a resource stored in a portal such as a web map, hosted layer, style, script tool, file, or notebook. Learn more . Maps from a web map A web map is a map stored as a JSON object that defines properties such as the basemap layer, data layers, layer styles, and pop-up styles. Its JSON structure is defined by the web map specification. Learn more portal item An item, also known as a content item, is a resource stored in a portal such as a web map, hosted layer, style, script tool, file, or notebook. Learn more authored in ArcGIS Pro ArcGIS Pro is a professional desktop GIS application that can explore, visualize, analyze, and manage 2D and 3D data. Learn more version 2.6 or higher may also include utility networks.

When using either a URL to a feature service or a portal item An item, also known as a content item, is a resource stored in a portal such as a web map, hosted layer, style, script tool, file, or notebook. Learn more as source, create and load a service geodatabase with tables A table is a non-spatial dataset in a feature service. All records in a table share the same set of fields. Learn more that are used to create the layers on the map. Then create a utility network with the service geodatabase.

let geodatabase = ServiceGeodatabase(url: featureServiceURL)
try await geodatabase.load()
let map = Map(basemapStyle: .arcGISStreetsNight)
guard let featureTable = geodatabase.table(withLayerID: 0) else { return }
let featureLayer = FeatureLayer(featureTable: featureTable)
map.addOperationalLayer(featureLayer)
let utilityNetwork = UtilityNetwork(serviceGeodatabase: geodatabase)

When using a web map portal item An item, also known as a content item, is a resource stored in a portal such as a web map, hosted layer, style, script tool, file, or notebook. Learn more URL as source, get the utility network from a loaded map.

let map = Map(url: webmapURL)
try await map?.load()
var utilityNetwork: UtilityNetwork?
if let utilityNetworksCount = map?.utilityNetworks.count,
utilityNetworksCount > 0 {
utilityNetwork = map?.utilityNetworks.first
}

Branch-versioning

When a utility network is based on a ServiceGeodatabase that points to an ArcGIS Enterprise ArcGIS Enterprise is a GIS mapping, analytics, data hosting, and content management product that can be hosted on-premise or in a cloud infrastructure. It includes software, applications, tools, APIs, and services for users and developers. Learn more Feature Service A feature service is a data service that provides access to spatial and non-spatial data in feature layers, feature layer views, and tables. Learn more (version 10.6 or higher) with branch versioning enabled, you can view, edit, and perform a trace on specific versions. Read more about Branch versioning in the ArcGIS Pro documentation and see the Loading resources asynchronously.

A service geodatabase A geodatabase is a spatial data storage format that can contain multiple datasets of geographic features and non-spatial tabular data, as well as attachments, field domain definitions, and relationships between layers/tables. Learn more can be created in a persistent or transient session. Using a web map or creating a service geodatabase A geodatabase is a spatial data storage format that can contain multiple datasets of geographic features and non-spatial tabular data, as well as attachments, field domain definitions, and relationships between layers/tables. Learn more without a session type by default creates a service geodatabase in a transient session. A service geodatabase in a persistent session acquires a shared lock from the server during load which may be upgraded to an exclusive lock during an edit to allow multiple simultaneous viewers or a single editor. A service geodatabase in a transient session will not hold a lock to allow concurrent viewers and editors.

let serviceGeodatabase = ServiceGeodatabase(url: featureServiceURL, sessionType: .persistent)

To create and switch to the new version …

let versionParameters = ServiceVersionParameters()
versionParameters.access = .private
versionParameters.name = "MyVersionName"
let versionInfo = try await utilityNetwork?.serviceGeodatabase?.makeVersion(parameters: versionParameters)
guard let versionName = versionInfo?.name else { return }
try await utilityNetwork?.serviceGeodatabase?.switchToVersion(named: versionName)

To get versions accessible to the logged-in user and switch to a specific version …

let versionInfos = try await utilityNetwork?.serviceGeodatabase?.versions
if let foundVersionInfo = versionInfos?.first(where: { $0.name == "userName.MyVersionName" }) {
try await utilityNetwork?.serviceGeodatabase?.switchToVersion(named: foundVersionInfo.name)
}

Access a utility network from an offline source

Offline Offline is the state of having no network connection and applications cannot access ArcGIS Online or ArcGIS Enterprise. Learn more sources include path to a mobile geodatabase A mobile geodatabase (.geodatabase) is a spatial data storage format in a single file on disk that can store, query, and manage spatial and nonspatial data. In applications built with the ArcGIS Maps SDKs for Native Apps, mobile geodatabases can be used in offline workflows when taking maps and features offline from services or in desktop-based scenarios as standalone mobile geodatabases from ArcGIS Pro. Learn more file with a *.geodatabase extension or a web map containing a UtilityNetwork that has been taken offline.

A mobile geodatabase source can be one of the following:

  • a stand-alone mobile geodatabase A mobile geodatabase (.geodatabase) is a spatial data storage format in a single file on disk that can store, query, and manage spatial and nonspatial data. In applications built with the ArcGIS Maps SDKs for Native Apps, mobile geodatabases can be used in offline workflows when taking maps and features offline from services or in desktop-based scenarios as standalone mobile geodatabases from ArcGIS Pro. Learn more that is exported from ArcGIS Pro ArcGIS Pro is a professional desktop GIS application that can explore, visualize, analyze, and manage 2D and 3D data. Learn more 2.7 or higher

  • a sync-enabled mobile geodatabase that is generated from ArcGIS Enterprise ArcGIS Enterprise is a GIS mapping, analytics, data hosting, and content management product that can be hosted on-premise or in a cloud infrastructure. It includes software, applications, tools, APIs, and services for users and developers. Learn more Feature Service 10.9 or higher using a GeodatabaseSyncTask or OfflineMapSyncTask.

When using a mobile geodatabase, create and load a geodatabase A geodatabase is a spatial data storage format that can contain multiple datasets of geographic features and non-spatial tabular data, as well as attachments, field domain definitions, and relationships between layers/tables. Learn more whose tables A table is a non-spatial dataset in a feature service. All records in a table share the same set of fields. Learn more are used to create the layers A layer is a reference to a collection of geographic data that is used to access and display data. The data for layers are typically provided by the basemap layer service and data services. Learn more and utility networks on the map.

let geodatabase = Geodatabase(fileURL: pathToGeodatabase)
let map = Map(basemapStyle: .arcGISStreetsNight)
guard let featureTable = geodatabase.featureTable(withServiceLayerID: 0) else { return }
let featureLayer = FeatureLayer(featureTable: featureTable)
map.addOperationalLayer(featureLayer)
if geodatabase.utilityNetworks.count > 0 {
let utilityNetwork = geodatabase.utilityNetworks.first!
map.addUtilityNetwork(utilityNetwork)
}

Load the utility network

The utility network follows the loadable Loadable is a characteristic of a resource, such as a layer, map, or portal item, that allows developers to perform asynchronous operations while the resource loads. Learn more pattern described in Loading resources asynchronously.

Loading the utility network loads the entire utility network schema (information about the datasets that participate in the network). Once loaded, your app can navigate this network schema to discover the domain networks A domain network is the primary classification of a utility network, representing the utility system type, such as electricity, gas, or water. Learn more it contains and any further details about the network. The utility network’s definition includes the capabilities supported by the utility network object, such as whether tracing and/or querying associations An association is a relationship between two elements that is reflected in a utility network topology. Learn more are supported.

try await utilityNetwork.load()
if let doesSupportTrace = utilityNetwork.definition?.capabilities.supportsTrace,
doesSupportTrace {
traceResults = try await utilityNetwork.trace(using: traceParameters)
}
if let doesSupportQueryAssociations = utilityNetwork.definition?.capabilities.supportsQueryAssociations,
doesSupportQueryAssociations {
associations = try await utilityNetwork.associations(for: element)
}