View in MAUI WPF WinUI View on GitHub Sample viewer app
import InlineCode from "@esri-dx/starship-doc-components/components/InlineCode.astro";

Discover connected features in a utility network using connected, subnetwork, upstream, and downstream traces.

Image of trace utility network

Use case

You can use a trace to visualize and validate the network topology of a utility network for quality assurance. Subnetwork traces are used for validating whether subnetworks, such as circuits or zones, are defined or edited appropriately.

How to use the sample

Tap on one or more features while ‘Add starting locations’ or ‘Add barriers’ is selected. When a junction feature is identified, you may be prompted to select a terminal. When an edge feature is identified, the distance from the tapped location to the beginning of the edge feature will be computed. Select the type of trace using the drop down menu. Click ‘Trace’ to initiate a trace on the network. Click ‘Reset’ to clear the trace parameters and start over.

How it works

  1. Create a
    and subscribe to its
    event.
  2. Create and load a
    with a web map item URL that contains a
    .
  3. Get and load the first
    from the web map.
  4. Get the
    from the utility network and fetch the line
    from the
    ’s tables.
  5. Add a
    with symbology that distinguishes starting locations from barriers.
  6. Identify features on the map and add a
    that represents its purpose (starting location or barrier) at the tapped location.
  7. Create a
    for the identified feature.
  8. Determine the type of this element using its
    property.
  9. If the element is a junction with more than one terminal, display a terminal picker. Then set the junction’s
    property with the selected terminal.
  10. If an edge, set its
    property using
    .
  11. Add this
    to a collection of starting locations or barriers.
  12. Create
    with the selected trace type along with the collected starting locations and barriers (if applicable).
  13. Set the
    with the tier’s
    result.
  14. Run a
    with the specified parameters.
  15. For every
    in the map, select the features returned with
    from the elements matching their
    with the layer’s
    .

Relevant API

  • FractionAlong
  • ServiceGeodatabase
  • UtilityAssetType
  • UtilityDomainNetwork
  • UtilityElement
  • UtilityElementTraceResult
  • UtilityNetwork
  • UtilityNetworkDefinition
  • UtilityNetworkSource
  • UtilityTerminal
  • UtilityTier
  • UtilityTraceConfiguration
  • UtilityTraceParameters
  • UtilityTraceResult
  • UtilityTraceType
  • UtilityTraversability

About the data

The Naperville Electric Web Map contains a utility network used to run the subnetwork-based 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.

A

component can be used for various utility network related use cases. For information about setting up the toolkit, as well as code for the component, visit the toolkit repository.

Tags

condition barriers, downstream trace, network analysis, subnetwork trace, toolkit, trace configuration, traversability, upstream trace, utility network, validate consistency

Sample Code

TraceUtilityNetwork.xaml TraceUtilityNetwork.xaml TraceUtilityNetwork.xaml.cs
<UserControl x:Class="ArcGIS.WPF.Samples.TraceUtilityNetwork.TraceUtilityNetwork"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
<Grid>
<esri:MapView x:Name="MyMapView" GeoViewTapped="OnGeoViewTapped" />
<Border x:Name="MainUI"
HorizontalAlignment="Right"
VerticalAlignment="Top"
IsEnabled="False"
Style="{StaticResource BorderStyle}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<RadioButton x:Name="IsAddingStartingLocations"
Content="Add starting locations"
GroupName="AddState"
IsChecked="True" />
<RadioButton Grid.Column="1"
Content="Add barriers"
GroupName="AddState" />
<Grid Grid.Row="1"
Grid.ColumnSpan="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Margin="5"
VerticalAlignment="Center"
Text="Trace Type:" />
<ComboBox x:Name="TraceTypes"
Grid.Column="1"
Margin="5"
HorizontalContentAlignment="Stretch" />
</Grid>
<Button Grid.Row="2"
Margin="5"
Click="OnReset"
Content="Reset" />
<Button Grid.Row="2"
Grid.Column="1"
Margin="5"
Click="OnTrace"
Content="Trace" />
<TextBlock x:Name="Status"
Grid.Row="3"
Grid.ColumnSpan="2"
Margin="0,5,0,5"
Text="Loading sample..." />
<ProgressBar x:Name="IsBusy"
Grid.Row="4"
Grid.ColumnSpan="2"
Height="15"
IsIndeterminate="True"
Visibility="Collapsed" />
</Grid>
</Border>
<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>