Developing Electrical Utility Web Trace Tool using JavaScript

The Utility Network Manager as an extension in ESRI ArcGIS suite, resembles the nature of SOA (Service Oriented Architecture). In this blog entry, I would like to describe how we can develop a simple Electrical Utility Web Trace Tool using ESRI JavaScript API. Let's get started: -

Load the Web Map

First we select the web map instead of loading a raw feature service. This will trigger two things:

  1. We check if the web map is pointing to a feature service and make sure that the feature service has a utility network. Only then we create a utilitynetwork object by passing the feature service URL and the token. The Utilitynetwork class is a helper class that does all the heavy lifting of querying various end points to pull the necessary meta data to open a utility network.

  2. We load the web map into a Map View in the browser using the ArcGIS for Javascript api. The non-blocking asynchronous nature of javascript allows the utility network to be created while the map view is loaded.

Query and highlight subnetwork

Having access to the full definition of the utility network, we can list properties like domain networks, tiers, network attributes etc.

We first populate all the domains network in the utility network in a drop-down list. When the user selects a domain network all the tiers that are available in that domain network will be populated. The user selects a tier, we call a rest endpoint to query the subnetworks table to filter out all subnetworks that belong to that tier. The subnetworks table is a table published as a layer in the feature service. To get access to that layer we need to ask the utility network for its subnetwork layer id so we can query for subnetworks. The utilitynetwork helper class has that method that returns the subnetline layer which is in the utility network definition. We then query that layer only returning geometry. Finally, we create a graphic of the returned geometry and add it to the map view making sure to clear all existing graphics to end up with multiple graphics on the map.


The trace method is a REST end-point on the Utility Network Server extension. It takes many parameters, starting points, barriers, trace type, trace definition and many related to the version and moment which are optional. We will do Subnetwork Trace.

To run a subnetwork trace, the REST trace method is expecting the subnetwork name along with the domain name and tier name. We will require subnetwork definition which is the “boundary” of a subnetwork, e.g. in the electric network would be to stop the trace when it finds an open device.The subnetwork definition is part of the tier the subnetwork belongs to. To retrieve that we need to pull that of the tier.

We now need to send a POST request with all the information including the token, leaving the version, sessionid and moment blank, the trace will be executed on the latest representation of the Default branch.

Trace Results

The trace results by default returns an array of features, however it only returns these attributes “SourceID”, “GlobalID” and the “ObjectID”. There is no Layerid. The SourceID is an internal representation of the feature classes that acts as sources for the utility network. We will have to map the SourceID to the LayerId. Utilitynetwork helper class has a nice method namely getLayerIdfromSourceId that does just that.

Then we will recollect all results grouped by layerId and objectIds and make few queries to retrieve the geometries of those features so that we can draw graphics, to highlight the results on the map.

Above is the graphic result of selected features from the trace result.


This work highlights the power of the services oriented architecture nature of the Utility Network Management extension.

At Agilytics we have the capability to develop customized tools using javascript, to enable various network services for Utility Network web applications.

Contact us at agilytics or write to us to for more details.

Note: Source code is available on request.

26 views0 comments