Skip to main content
Solved

Create group ID based on conditions?


aron
Supporter
Forum|alt.badge.img+16
  • Supporter

The two lines below share the same end nodes and I want to give them a common group id for later processing. This is to be the step after a TopologyBuilder.

I thought this would be pretty simple, but have run aground. So how do I achieve this?

The geometris are to be left unchanged. I just want them to have a common “id” if they intersect at both ends.

The conditions for the ‘join’ are:

_from_node = _from_node AND _to_node = _to_node

OR

_from_node = _to_node AND _to_node = _from_node

Because sometimes the lines orient in different directions.

 

 

Best answer by takashi

Hi ​@aron ,

My idea is to create group ID by concatenating “_from_node” and “_to_node” with ascending order. The concept is shown below.

  • _node1 = If _from_node < _to_node then _from_node, Else _to_node
  • _node2 = If _from_node < _to_node then _to_node, Else _from_node
  • _group_id = @Value(_node1)_@Value(_node2) 
View original
Did this help you find an answer to your question?

6 replies

takashi
Contributor
Forum|alt.badge.img+22
  • Contributor
  • Best Answer
  • April 4, 2025

Hi ​@aron ,

My idea is to create group ID by concatenating “_from_node” and “_to_node” with ascending order. The concept is shown below.

  • _node1 = If _from_node < _to_node then _from_node, Else _to_node
  • _node2 = If _from_node < _to_node then _to_node, Else _from_node
  • _group_id = @Value(_node1)_@Value(_node2) 

geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • April 4, 2025
takashi wrote:

My idea is to create group ID by concatenating “_from_node” and “_to_node” with ascending order. 

A very simple and elegant solution!

If you want to, you can skip creating _node1 and _node2 by using _group_id =  @min(@Value(_from_node),@Value(_to_node))_@max(@Value(_from_node),@Value(_to_node))

 


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • April 4, 2025

Would the NetworkTopologyCalculator not do this for you? 


aron
Supporter
Forum|alt.badge.img+16
  • Author
  • Supporter
  • April 4, 2025
ebygomm wrote:

Would the NetworkTopologyCalculator not do this for you? 

I believe that it would not get me where I want. There might be some trick with the NetworkTopologyCalculator that I dont know of, but when I have used it previously it gave me a ID for all the connected lines. I want to group only those that share the same start and end.


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • April 4, 2025

Ah too early in the morning for me, you’re actually looking for rings?


aron
Supporter
Forum|alt.badge.img+16
  • Author
  • Supporter
  • April 4, 2025
ebygomm wrote:

Ah too early in the morning for me, you’re actually looking for rings?

I haven't thought about it that way, but two part rings would be an accurate description. AreaBuilder does not work for my use case though, it gives far to many false positives. 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings