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.
Hi @geospatiallover, I would try this.
- Create network nodes and edges from the original network lines using the TopologyBuilder.
Calculate the length of every edge and add it to them as an attribute.
Create 'from-to' lines between each junction and the source.
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,
- Extract junctions (points) from the path. Probably the PathSplitter and Snipper can be used.
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.
Hi @geospatiallover, I would try this.
- Create network nodes and edges from the original network lines using the TopologyBuilder.
Calculate the length of every edge and add it to them as an attribute.
Create 'from-to' lines between each junction and the source.
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,
- Extract junctions (points) from the path. Probably the PathSplitter and Snipper can be used.
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?
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.
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.