The need: We recently had a request from a client to create a custom ArcMap trace that could change colors depending on the features it encountered as it traced out the network. This was an intriguing challenge and we wanted to share it with the community to see where else this concept might be used.
At first we went down the path of trying to figure out a way to use the Esri out of the box traces to meet this requirement. You can change the color of the trace results using the trace Analysis Options available from the Utility Network Analyst toolbar or any of the SE trace toolbars:
But this change in color simply changes the color of ALL of the trace results. This can be useful when you need to differentiate the trace results from other colors already used on the map. For example, the default trace results color is red but if you symbolize an existing linear feature class with a red color then the trace results will not be easily differentiated from the underlying features. In this case changing the default color makes sense. But our requirement was to change the color of the results within the same trace.
Next we delved into the code required to manipulate the network traces. We have written many custom traces in the past and were able to use that knowledge to quickly get the extent of the trace. The key here is to use the Esri TraceWeight values to determine the key properties of the GIS features as opposed to parsing individual values of the GIS features. This is a tangent from our current topic (perhaps a good topic for another article) but worth explaining just a bit further for those that might not be familiar with TraceWeights. When you build your Esri geometric network it allows you to define a common field across the various feature classes included in the network that will contain the TraceWeight. SE uses a trace weight for the electric, gas, and water networks (electric shown here):
This field will typically be an integer field. It is special to the Esri traces because the trace exposes the trace weight of features encountered in the trace in a very efficient way. The numeric value entered into the trace weight field will typically be the compilation of different bits of information (pun intended) from the feature’s attributes. For example on an electric switch we use various bits to define that the device is a switch, whether its energized on various phases, and whether each phase is open or closed.
All of these feature attribute values are combined into a single numeric value which becomes the trace weight. We have covered the electric trace weight field from SE in a previous article if you are interested in reading more. The same concept applies to gas and water trace weights as well. Within the Esri geometric network, we then further define the fields on each feature class that contain the trace weight value:
So that’s the background on the Esri magic that allows the out of the box Esri and SE traces to work efficiently. SE uses a series of AutoUpdaters to keep the trace weights up to date on the individual features. The trace then parses that single numeric field and uses the individual bits to determine important properties of the corresponding features.
So back to the original topic... our first piece of work was to build a custom trace that could interpret the trace weights. This would allow us to determine how far to trace out from the point of origin. In a typical trace you get your set of results and pass it back to Esri to display as their standard trace results. But this technique follows the above-mentioned single color approach which wasn’t going to meet our requirement because we couldn’t control the color. So next we built out a small piece of code to determine the exact color of each feature in the trace. In our case we were working with a Gas Cathodic Protection (CP) trace that needed to change colors as it encountered different attribute values in the trace. Specifically we were changing the color when we encountered properties for a CP Anode, CP Rectifier, or a Joint Trench indicator. You already guessed it - these three attributes were already being stored as bits in the trace weight for the gas features.
Once we determined which features needed to be certain colors, we built our own graphics engine that would create colored linear and point graphics on the map representing the properties of our custom trace. To better explain the specific trace requirements let’s look at a simplified example. Below we see a length of gas main that is broken by three CP devices that have either their anode, rectifier, or joint trench attributes set:
When we run our custom trace starting at the left most CP device with the anode number set, the trace starts out green, then as it hits the rectifier attribute it changes to orange and finally as it hits the joint trench attribute it changes to blue:
The traced out colors on the map allow the user to quickly review the properties of the CP system without having to individually inspect the underlying features. This was a pretty interesting use of Esri tracing because it presented the data in a new visual format. It provides significant additional value over the out of the box single color trace which only shows the full extent of the CP system. The downside of this approach is that it has to manage its own graphics engine and because of this will be slightly slower than the out of the box Esri and SE traces but in this case the pros far outweighed the cons.
This example got me to thinking about where else this type of network trace by color might be used in the utility industry. I’d be interested to hear feedback from our readers as well but here are some ideas I came up with:
Electric Voltage Trace: A trace that would symbolize the various voltage levels by color where 39KV and up would be one color, distribution from the substation to the transformers would be another color, and then the secondary and service would be a third color.
Gas or Water Pressure Trace: A trace that would use different colors to represent various pressures using different colors. This trace could continue though regulator stations and other pressure system barriers based on configuration and would provide a quick colored representation of the features.
Electric Trace by Phase: We could use different colors to represent the phases present within a given distribution circuit. Three phase could be red, two phase could be blue, and single phase could be green.
Trace by Circuit or System: A trace that could show differing circuits or pressure systems by color within a certain map boundary. This would allow you to view the distinct circuits or systems within your map display without having to build a custom map document or stored display.