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'. Tap 'Trace' to run a subnetwork-based isolation trace. Tap 'Reset' to clear filter barriers.
How it works
- Create a
MapViewand subscribe to itsGeoViewTappedevent. - Create and load a
ServiceGeodatabasewith a feature service URL and get tables by their layer IDs. - Create a
Mapthat containsFeatureLayer(s) created from theServiceGeodatabase's tables. - Create and load a
UtilityNetworkwith the same feature service URL and thisMap. - Create
UtilityTraceParameterswithUtilityTraceType.Isolationand a starting location from a given asset type and global ID. - Get a default
UtilityTraceConfigurationfrom a given tier in a domain network to setUtilityTraceParameters.TraceConfiguration. - Add a
GraphicsOverlaywith aGraphicthat represents this starting location; and anotherGraphicsOverlayfor 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
Graphicthat represents a filter barrier. - Create a
UtilityElementfor the identified feature and add thisUtilityElementto 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
Terminalproperty with the selected terminal. - If an edge, set its
FractionAlongLineproperty 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 tapped without filter barriers:
- Create a new
UtilityCategoryComparisonwith the selected category andUtilityCategoryComparisonOperator.Exists. - Create a new
UtilityTraceFilterwith this condition asBarriersto setFilterand updateIncludeIsolatedFeaturesproperties of the default configuration from step 5. - Run a
UtilityNetwork.TraceAsync.
- Update
IncludeIsolatedFeaturesproperty of the default configuration from step 5. - Run a
UtilityNetwork.TraceAsync.
- Create a new
- For every
FeatureLayerin the map, select the features returned withGetFeaturesForElementsAsyncfrom the elements matching theirNetworkSource.FeatureTablewith 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
<ContentPage x:Class="ArcGISRuntimeXamarin.Samples.PerformValveIsolationTrace.PerformValveIsolationTrace"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
xmlns:resources="clr-namespace:Forms.Resources;assembly=ArcGISRuntime">
<RelativeLayout>
<esriUI:MapView x:Name="MyMapView"
BindingContext="{x:Reference Name=ResponsiveFormContainer}"
GeoViewTapped="OnGeoViewTapped"
Style="{StaticResource MapWithFormStyle}" />
<resources:ResponsiveFormContainer x:Name="ResponsiveFormContainer">
<StackLayout x:Name="FilterOptions" Orientation="Vertical">
<Label Margin="5"
FontAttributes="Bold"
Text="Choose Category for Filter Barrier:" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Picker x:Name="CategoryPicker"
Grid.Column="0"
Margin="5"
ItemDisplayBinding="{Binding Name}"
TextColor="Black"
VerticalOptions="CenterAndExpand" />
<Button Grid.Column="1"
Margin="5"
Clicked="OnTrace"
Text="Trace" />
<Button Grid.Column="2"
Margin="5"
Clicked="OnReset"
Text="Reset" />
</Grid>
<StackLayout Orientation="Horizontal">
<Label Text="Include Isolated Features" VerticalOptions="Center" />
<Switch x:Name="IncludeIsolatedFeatures"
Margin="5"
IsToggled="False" />
</StackLayout>
</StackLayout>
</resources:ResponsiveFormContainer>
<ActivityIndicator x:Name="LoadingIndicator"
HorizontalOptions="CenterAndExpand"
IsRunning="True"
IsVisible="True"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent,
Property=Height,
Factor=1}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=1}"
VerticalOptions="CenterAndExpand" />
<Grid x:Name="PickerUI"
HorizontalOptions="CenterAndExpand"
IsVisible="False"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent,
Property=Height,
Factor=1}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=1}"
VerticalOptions="CenterAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0"
Margin="5"
HorizontalTextAlignment="Center"
Text="Choose a terminal for this junction." />
<ListView x:Name="TerminalPicker"
Grid.Row="1"
ItemSelected="Terminal_Selected" />
</Grid>
</RelativeLayout>
</ContentPage>