Solved

Network Statistics calculator


Badge +5

Using a geometric network, traversing from Source to all sinks, I am looking for a solution that will derive statistics on each junction that would tell me number of junctions downstream, branches on each junction downstream and lengths of every segment on each branch of the junction towards the sinks..I thought I've seen a custom transformer that can partially do this but I can't find it.

icon

Best answer by takashi 3 May 2016, 04:19

View original

4 replies

Userlevel 2
Badge +17

Hi @geospatiallover, I would try this.

  1. Create network nodes and edges from the original network lines using the TopologyBuilder.
  2. Calculate the length of every edge and add it to them as an attribute.
  3. Create 'from-to' lines between each junction and the source.
  4. Create shortest paths on the network edges for each 'from-to' line using the ShortestPathFinder. Set the Segment Attribute List parameter.

Each resulting path will have a list attribute containing lengths of segments in the path, and you can get the number of junctions on the path based on the number of elements of the list.

Then, regarding the number of branches on each junction,

  1. Extract junctions (points) from the path. Probably the PathSplitter and Snipper can be used.
  2. Relate the junctions with the network nodes using the SpatialRelator.

Every network node created by the TopolgyBuilder has a list attribute containing information of topologically connecting edges. You can merge the list to each junction with this spatial operation and then get the number of branches based on the number of elements of the list.

Badge +5

Hi @geospatiallover, I would try this.

  1. Create network nodes and edges from the original network lines using the TopologyBuilder.
  2. Calculate the length of every edge and add it to them as an attribute.
  3. Create 'from-to' lines between each junction and the source.
  4. Create shortest paths on the network edges for each 'from-to' line using the ShortestPathFinder. Set the Segment Attribute List parameter.

Each resulting path will have a list attribute containing lengths of segments in the path, and you can get the number of junctions on the path based on the number of elements of the list.

Then, regarding the number of branches on each junction,

  1. Extract junctions (points) from the path. Probably the PathSplitter and Snipper can be used.
  2. Relate the junctions with the network nodes using the SpatialRelator.

Every network node created by the TopolgyBuilder has a list attribute containing information of topologically connecting edges. You can merge the list to each junction with this spatial operation and then get the number of branches based on the number of elements of the list.

Thanks @takash. Two follow up questions. What's the best way to traverse all junctions from source to sinks? I can sort based on length from the source after the ShortestPathFinder and and use a counter but is there a way to do this without using length. (Assuming all segments are topologically correct). What's the best way to get the max count of a list attribute?

Userlevel 2
Badge +17

Thanks @takash. Two follow up questions. What's the best way to traverse all junctions from source to sinks? I can sort based on length from the source after the ShortestPathFinder and and use a counter but is there a way to do this without using length. (Assuming all segments are topologically correct). What's the best way to get the max count of a list attribute?

Since the resulting shortest path geometry from the ShortestPathFinder is a Path, you can enumerate all segments belonging to the path by splitting it with the PathSplitter. The split segments are output in the order from the start to end of the path, and an end node of each segment matches a junction.

The ListElementCounter can be used to retrieve the number of elements in a list attribute, and the StatisticsCalculator can be used to get the maximum of them.

Badge +5

Thanks for all your answers @takashi... I used your suggestions up to number 4 and the answers to the follow up questions. For the number of junctions per node, I added a list element counter after the TopologyBulilder and got the number of branches on each network node and later connected it with the SpatialRelator to the paths. This solution opens the door to a lot of our network related problems and I appreciate your help. A little note, the custom transformer ShortestPathBuilder that comes out of the box with Workbench still has the 2DPointAdder and it doesn't work anymore. I replaced mine with the VertexCreator and it produced the paths. I filed a Safe Support case for it to have the custom transformer updated.

Reply