Run a filtered trace to locate operable features that will isolate an area from the flow of network resources.

Use case
Determine the set of operable features required to stop a network’s resource, effectively isolating an area of the network. For example, you can choose to return only accessible and operable valves: ones that are not paved over or rusted shut.
How to use the sample
Tap on one or more features to use as filter barriers or create and set the configuration’s filter barriers by selecting a utility category. Toggle “Isolated Features” to update trace configuration. Tap “Trace” to run a subnetwork-based isolation trace. Tap “Reset” to clear filter barriers and trace results.
How it works
-
Create a
MapViewinstance. -
Create and load a
Mapwith a web map portal item that contains aUtilityNetwork. -
Create a
Mapobject that containsFeatureLayer(s) created from the service geodatabase’s tables. -
Create and load a
UtilityNetworkwith the same feature service URL and map. Use theonSingleTapGesturemodifier to listen for tap events on the map view. -
Create
UtilityTraceParameterswithisolationtrace type and a default starting location from a given asset type and global ID. -
Get a default
UtilityTraceConfigurationfrom a given tier in a domain network. Set itsfilterproperty with anUtilityTraceFilterobject. -
Add a
GraphicsOverlayfor showing starting location and filter barriers. -
Populate the choice list for the filter barriers from the
categoriesproperty ofUtilityNetworkDefinition. -
When the map view is tapped, identify which feature is at the tap location, and add a
Graphicto represent a filter barrier. -
Create a
UtilityElementfor the identified feature and add this element to the trace parameters’filterBarriersproperty.- If the element is a junction with more than one terminal, display a terminal picker. Then set the junction’s
terminalproperty with the selected terminal. - If it is an edge, set its
fractionAlongEdgeproperty usingGeometryEngine.polyline(_:fractionalLengthClosestTo:tolerance:)method.
- If the element is a junction with more than one terminal, display a terminal picker. Then set the junction’s
-
If “Trace” is tapped without filter barriers:
- Create a new
UtilityCategoryComparisonwith the selected category andUtilityCategoryComparison.Operator.exists. - Assign this condition to
UtilityTraceFilter.barriersfrom the default configuration from step 6. - Update the configuration’s
includesIsolatedFeaturesproperty. - Set this configuration to the parameters’
traceConfigurationproperty. - Run
UtilityNetwork.trace(parameters:)with the specified parameters.
If “Trace” is tapped with filter barriers:
- Update
includesIsolatedFeaturesproperty of the default configuration from step 6. - Run
UtilityNetwork.trace(parameters:)with the specified parameters.
- Create a new
-
For every
FeatureLayerin this map with trace result elements, select features by convertingUtilityElement(s) toArcGISFeature(s) usingUtilityNetwork.features(for:).
Relevant API
- GeometryEngine.polyline(_:fractionalLengthClosestTo:tolerance:)
- ServiceGeodatabase
- UtilityCategory
- UtilityCategoryComparison
- UtilityCategoryComparison.Operator
- UtilityDomainNetwork
- UtilityElement
- UtilityElementTraceResult
- UtilityNetwork
- UtilityNetworkDefinition
- UtilityTerminal
- UtilityTier
- UtilityTraceFilter
- UtilityTraceParameters
- UtilityTraceParameters.TraceType
- UtilityTraceResult
About the data
The Naperville gas network feature service, hosted on ArcGIS Online, contains a utility network used to run the isolation trace shown in this sample.
Additional information
Using utility network on ArcGIS Enterprise 10.8 requires an ArcGIS Enterprise member account licensed with the Utility Network user type extension. Please refer to the utility network services documentation.
Tags
category comparison, condition barriers, filter barriers, isolated features, network analysis, subnetwork trace, trace configuration, trace filter, utility network