Display content of utility network container

View inFormsWPFWinUIView on GitHub

A utility network container allows a dense collection of features to be represented by a single feature, which can be used to reduce map clutter.

Image of display content of utility network container

Use case

Offering a container view for features aids in the review for valid structural attachment and containment relationships and helps determine if a dataset has an association role set. Container views often model a cluster of electrical devices on a pole top or inside a cabinet or vault.

How to use the sample

Tap on a container feature to show all features inside the container. The container is shown as a polygon graphic with the content features contained within. The viewpoint and scale of the map are also changed to the container's extent. Connectivity and attachment associations inside the container are shown as red and blue dotted lines respectively.

How it works

  1. Load a web map that includes ArcGIS Pro Subtype Group Layers with only container features visible (i.e. fuse bank, switch bank, transformer bank, hand hole and junction box).
  2. Add a GraphicsOverlay for displaying a container view.
  3. Create and load a UtilityNetwork with the same feature service URL as the layers in the Map.
  4. Add an event handler for the GeoViewTapped event of the MapView.
  5. Identify a feature and create a UtilityElement from it.
  6. Get the associations for this element using GetAssociationsAsync(UtilityElement, UtilityAssociationType.Containment).
  7. Turn-off the visibility of all OperationalLayers.
  8. Get the features for the UtilityElement(s) from the associations using GetFeaturesForElementsAsync(IEnumerable<UtilityElement>)
  9. Add a Graphic with the same geometry and symbol as these features.
  10. Add another Graphic that represents the combined extents of these features.
  11. Get associations for this extent using GetAssociationsAsync(Envelope)
  12. Add a Graphic to represent the association geometry between them using a symbol that distinguishes between Attachment and Connectivity association type.
  13. Zoom to the combined extents of the features in the container.
  14. To exit the container view, clear the Graphics and zoom out to the previous extent.

Relevant API

  • SubtypeFeatureLayer
  • UtilityAssociation
  • UtilityAssociationType
  • UtilityElement
  • UtilityNetwork
  • UtilityNetworkDefinition

About the data

The Naperville electric feature service contains a utility network layer used to find associations shown in this sample. The Naperville electric containers webmap uses the same feature service endpoint and displays only container features. 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

associations, connectivity association, containment association, structural attachment associations, utility network

Sample Code

DisplayUtilityNetworkContainer.xamlDisplayUtilityNetworkContainer.xamlDisplayUtilityNetworkContainer.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<ContentPage x:Class="ArcGISRuntimeXamarin.Samples.DisplayUtilityNetworkContainer.DisplayUtilityNetworkContainer"
             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">
    <RelativeLayout>
        <esriUI:MapView x:Name="MyMapView"
                        GeoViewTapped="MyMapView_GeoViewTapped"
                        Style="{StaticResource MapWithFormStyle}" />
        <resources:ResponsiveFormContainer x:Name="ResponsiveFormContainer">
            <StackLayout>
                <Label Margin="5" Text="Tap an element to view its container." />
                <Label Margin="5"
                       FontAttributes="Bold"
                       Text="Utility association types" />
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="25" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Label Grid.Row="0"
                           Grid.Column="1"
                           Text="Attachment" />
                    <Label Grid.Row="1"
                           Grid.Column="1"
                           Text="Connectivity" />
                    <Label Grid.Row="2"
                           Grid.Column="1"
                           Text="Containment" />
                    <Image x:Name="AttachmentImage"
                           Grid.Row="0"
                           Grid.Column="0" />
                    <Image x:Name="ConnectivityImage"
                           Grid.Row="1"
                           Grid.Column="0" />
                    <Image x:Name="ContainmentImage"
                           Grid.Row="2"
                           Grid.Column="0" />
                </Grid>
                <Button x:Name="CloseButton"
                        Margin="5"
                        Clicked="CloseButton_Clicked"
                        IsVisible="false"
                        Text="Close container view" />
            </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" />
    </RelativeLayout>
</ContentPage>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.