View on GitHub Sample viewer app

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

Click on a container feature to show all features inside the container (the container view bounding box is marked by a yellow dashed line). The container is shown 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. Create a GraphicsOverlay for displaying a container view.
  3. Create and load a UtilityNetwork with the same feature service URL as the layers in the web map (Naperville electric network feature service in this sample).
  4. Add an event handler for the onMouseClicked 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 the map’s operational layers.
  8. Get the features for the UtilityElement(s) from the associations using fetchFeaturesForElementsAsync(List<UtilityElement>).
  9. Add a Graphic with the same geometry and symbol as these features.
  10. Add another Graphic that represents this extent and zoom to this extent with a buffer.
  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 association types (attachment and connectivity in this sample data).
  13. Turn on the visibility of all the map’s operational layers, clear the graphics in the graphics overlay, and zoom out to the previous extent to exit the container view.

Relevant API

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

About the data

The Naperville electric network feature service, hosted on ArcGIS Online, contains a utility network used to find associations shown in this sample and a web map portal item, Naperville electric containers, that use the same feature service endpoint and displays only container features.

Tags

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

Sample Code

module-info.java module-info.java DisplayContentOfUtilityNetworkContainerController.java DisplayContentOfUtilityNetworkContainerSample.java
/*
* Copyright 2022 Esri.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module com.esri.samples.display_content_of_utility_network_container {
// require ArcGIS Maps SDK for Java module
requires com.esri.arcgisruntime;
// handle SLF4J http://www.slf4j.org/codes.html#StaticLoggerBinder
requires org.slf4j.nop;
// require JavaFX modules that the application uses
requires javafx.graphics;
requires javafx.controls;
requires javafx.fxml;
// make all @FXML annotated objects reflectively accessible to the javafx.fxml module
opens com.esri.samples.display_content_of_utility_network_container to javafx.fxml;
exports com.esri.samples.display_content_of_utility_network_container;
}