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 category. Check or uncheck 'Include Isolated Features'. Click 'Trace' to run a subnetwork-based isolation trace. Click 'Reset' to clear filter barriers.
How it works
- Create a
MapView
and subscribe to itsGeoViewTapped
event. - Create and load a
ServiceGeodatabase
with a feature service URL and get tables by their layer IDs. - Create a
Map
that containsFeatureLayer
(s) created from theServiceGeodatabase
's tables. - Create and load a
UtilityNetwork
with the same feature service URL and thisMap
. - Create
UtilityTraceParameters
withUtilityTraceType.Isolation
and a starting location from a given asset type and global ID. - Get a default
UtilityTraceConfiguration
from a given tier in a domain network to setUtilityTraceParameters.TraceConfiguration
. - Add a
GraphicsOverlay
with aGraphic
that represents this starting location; and anotherGraphicsOverlay
for filter barriers. - Populate the choice list for the 'Filter Barrier: Category exists' from
UtilityNetworkDefinition.Categories
. - When the MapView is tapped, identify which features are at the tap location and add a
Graphic
that represents a filter barrier. - Create a
UtilityElement
for the identified feature and add thisUtilityElement
to a collection of filter barriers.- If the element is a junction with more than one terminal, display a terminal picker. Then set the junction's
Terminal
property with the selected terminal. - If an edge, set its
FractionAlongLine
property usingGeometryEngine.FractionAlong
.
- If the element is a junction with more than one terminal, display a terminal picker. Then set the junction's
- If 'Trace' is clicked without filter barriers:
- Create a new
UtilityCategoryComparison
with the selected category andUtilityCategoryComparisonOperator.Exists
. - Create a new
UtilityTraceFilter
with this condition asBarriers
to setFilter
and updateIncludeIsolatedFeatures
properties of the default configuration from step 5. - Run a
UtilityNetwork.TraceAsync
.
- Update
IncludeIsolatedFeatures
property of the default configuration from step 5. - Run a
UtilityNetwork.TraceAsync
.
- Create a new
- For every
FeatureLayer
in the map, select the features returned withGetFeaturesForElementsAsync
from the elements matching theirNetworkSource.FeatureTable
with the layer'sFeatureTable
.
Relevant API
- FractionAlong
- ServiceGeodatabase
- UtilityCategory
- UtilityCategoryComparison
- UtilityCategoryComparisonOperator
- UtilityDomainNetwork
- UtilityElement
- UtilityElementTraceResult
- UtilityNetwork
- UtilityNetworkDefinition
- UtilityTerminal
- UtilityTier
- UtilityTraceFilter
- UtilityTraceParameters
- UtilityTraceResult
- UtilityTraceType
About the data
The Naperville gas network feature service contains a utility network used to run the isolation trace shown in this sample. Authentication is required and handled within the sample code.
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
Sample Code
<UserControl x:Class="ArcGIS.UWP.Samples.PerformValveIsolationTrace.PerformValveIsolationTrace"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
<Grid>
<esriUI:MapView x:Name="MyMapView" GeoViewTapped="OnGeoViewTapped" />
<Border x:Name="MainUI"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Style="{StaticResource BorderStyle}">
<Grid x:Name="FilterOptions">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Margin="5"
FontWeight="Bold"
Text="Choose Category for Filter Barrier:" />
<ComboBox x:Name="Categories"
Grid.Row="1"
Margin="5">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<CheckBox x:Name="IncludeIsolatedFeatures"
Grid.Row="2"
Margin="5"
Content="Include Isolated Features" />
<Button Grid.Row="1"
Grid.Column="1"
Margin="5"
Click="OnTrace"
Content="Trace" />
<Button Grid.Row="1"
Grid.Column="2"
Margin="5"
Click="OnReset"
Content="Reset" />
</Grid>
</Border>
<ProgressBar x:Name="LoadingBar"
Width="200"
Height="25"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
IsIndeterminate="True"
Visibility="Visible" />
<Border Name="TerminalPicker"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{StaticResource BorderStyle}"
Visibility="Collapsed">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Margin="5"
Text="Select the terminal for this junction." />
<ComboBox x:Name="Picker"
Grid.Row="1"
Margin="5">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button Grid.Row="2"
Margin="5"
Click="OnTerminalSelected"
Content="Select" />
</Grid>
</Border>
</Grid>
</UserControl>