Question

Sorting data in the order of flow path

  • 23 January 2020
  • 5 replies
  • 3 views

Hello all,

 

I have a series of flow paths along a network, each with a unique ID. I want to essentially produce an elevation profile graph along each path by sorting the data and writing into an excel template.

I have split the single paths at each node, and linked the elevation of that node to each _from_node and _to_node. However, i'm struggling to figure out how to sort the data in the order of the path. Each path doesn't follow the pattern of Node 1 - Node 2 - Node 3, etc. Some will jump around, e.g. Node 1 - Node 2 - Node 13 - Node 7, and so on.

The information is contained within the _from_node and _to_node attributes, but i cant figure out a way to sort this data, apart from possibly using an indefinite number of joins on the _from_node and _to_node attributes.

Any ideas would be greatly appreciated!

Thanks!

Jack


5 replies

Badge +3

This is usually solved by Network Graphing techniques. There are a couple of ways:

  1. Building logical tables of Nodes and Links and using SQL recursion to trace through the Links table from a Start Node to an End Node.
  2. Building a geometric network of Nodes and Links and building pathways

I won't go too much into Method 1, because it actually sounds like you have the geometry data already to do Method 2. Essentially, you just need to move the ends of the split lines to the same elevation as the intersecting Nodes, remove the intermediate vertices, recombine the lines by their Unique Flow Path ID. By definition, the resulting line will be an ordered list of vertices, with an ordered set of Z values/elevations

  1. With the split lines, remove any Intermediate Vertices with VertexRemover. The aim is to only leave behind vertices that correspond with your Elevation Nodes, which will be the end nodes of the aplit lines. Set "Coordinate Index" = 1, and "Number to Remove" = NumCoords()-2
  2. Attribute the split lines with their Start Elevation: FeatureJoiner->FromNodeID = NodeID
  3. Adjust the Z coordinate of the start vertex with VertexCreator: Mode = Replace Point At Index. Index=0, Z=FromNodeElevation
  4. Attribute the split lines with their End Elevation: FeatureJoiner->ToNodeID = NodeID
  5. Adjust the Z coordinate of the end vertex with VertexCreator: Mode=Replace Point At Index. Index=1, Z=ToNodeElevaton
  6. Join all the Split Lines back together with LineCombiner: Group By the Flow Path ID

So Step 6 basically creates an ordered array of X,Y,Z points as LineCombiner in this situation orders your network graph for you because it uses a geometric end point relationship to infer the logical order of the lines.

Getting this array out into a table is then just using CoordinateExtractor->All Points, and exploding the resulting ordered list of coordinates with ListExploder. Because in Step 1 any vertices that were not the Elevation Nodes got removed, then then the ordered coordinate list is just the Elevation Nodes.

 

Badge +2

@jacklonsdale Do you have a small sample dataset that you can share with the community to experiment with?

This is usually solved by Network Graphing techniques. There are a couple of ways:

  1. Building logical tables of Nodes and Links and using SQL recursion to trace through the Links table from a Start Node to an End Node.
  2. Building a geometric network of Nodes and Links and building pathways

I won't go too much into Method 1, because it actually sounds like you have the geometry data already to do Method 2. Essentially, you just need to move the ends of the split lines to the same elevation as the intersecting Nodes, remove the intermediate vertices, recombine the lines by their Unique Flow Path ID. By definition, the resulting line will be an ordered list of vertices, with an ordered set of Z values/elevations

  1. With the split lines, remove any Intermediate Vertices with VertexRemover. The aim is to only leave behind vertices that correspond with your Elevation Nodes, which will be the end nodes of the aplit lines. Set "Coordinate Index" = 1, and "Number to Remove" = NumCoords()-2
  2. Attribute the split lines with their Start Elevation: FeatureJoiner->FromNodeID = NodeID
  3. Adjust the Z coordinate of the start vertex with VertexCreator: Mode = Replace Point At Index. Index=0, Z=FromNodeElevation
  4. Attribute the split lines with their End Elevation: FeatureJoiner->ToNodeID = NodeID
  5. Adjust the Z coordinate of the end vertex with VertexCreator: Mode=Replace Point At Index. Index=1, Z=ToNodeElevaton
  6. Join all the Split Lines back together with LineCombiner: Group By the Flow Path ID

So Step 6 basically creates an ordered array of X,Y,Z points as LineCombiner in this situation orders your network graph for you because it uses a geometric end point relationship to infer the logical order of the lines.

Getting this array out into a table is then just using CoordinateExtractor->All Points, and exploding the resulting ordered list of coordinates with ListExploder. Because in Step 1 any vertices that were not the Elevation Nodes got removed, then then the ordered coordinate list is just the Elevation Nodes.

 

Hi bwn,

 

Thanks for the very detailed suggestion! I think it may fall down at the final hurdle however since I have multiple flows that converge down the same pathway at points which the LineCombiner doesn't deal well with!

@jacklonsdale Do you have a small sample dataset that you can share with the community to experiment with?

Hi Mark. Unfortunately not, it falls under client protection i'm afraid.

Badge +3

Hi bwn,

 

Thanks for the very detailed suggestion! I think it may fall down at the final hurdle however since I have multiple flows that converge down the same pathway at points which the LineCombiner doesn't deal well with!

Then that would mean that there is not a unique Flow Path ID as there will be segments belonging to multiple flow paths.

A variation to this (which I just used on a nearly identical project) is then to instead use ShortestPathFinder instead of LineCombiner, to derive the contiguous paths from the upstream points to the downstream point on the flow subnetwork. These paths will reuse the same common line sections to create multiple flow paths. Getting these into a single line is just taking the output of ShortestPathFinder and putting it through GeometryRefiner. Everything else is as described above.

The flow subnetworks themselves can be grouped with TopologyCalculator to limit ShortestPathFinder to only using start and end nodes on the connected flow paths. Start and End Nodes will be those that have only 1 Edge connected to then as output by TopologyBuilder.

Reply