Next Upstream Device Task


The Utility Network Analyst toolbar has a set of trace tasks (Find Connected, Trace Upstream, etc.) then can be used to solve many problems. The Next Upstream Device Task demonstrates how to create a custom trace task to add to the existing set of functionality. The task is designed to find the next upstream device from the specified flag based on the set of disabled layers. When performing the upstream trace, only those layers that have been disabled in the toolbar will be used for finding the next upstream device. As an example, if I want to find the next upstream valve from my flag, then I would disable only the valve layer.

How to use:
  1. Register the trace task with Categories.exe as an ESRI Utility Network Task.
  2. Close and restart ArcMap.
  3. Add your network to ArcMap. Use the Add Edge Flag or Add Junction Flag tools on the Utility Network Analyst toolbar to place a flag at the location you wish to trace from.
  4. Disable one or more layers using the toolbar (disable the layers whose features you want to search for).
  5. Choose "Next Upstream Device" from the list of available trace tasks and perform the trace. The result will be a selection set up the upstream devices that stopped the trace.


Requires: An Arcmap session with a geometric network loaded.

Difficulty: Advanced

Visual Basic
File Description
NextUpstreamDevice.cls Main class for the trace task.
NextUpstreamDevicePrj.vbp Project file for the trace task.

Key CoClasses: UtilityNetworkAnalysisExt, TraceFlowSolver
Key Interfaces: ITraceTask, IUtilityNetworkAnalysisExt, INetworkAnalysisExt, ITraceFlowSolver
Key Members: ITraceTask::OnCreate, ITraceTask::OnTraceExecution, ITraceFlowSolver::FindFlowEndElements