Solved

Combine overlapping/touching lines into one long simple geometric line


Badge +1

Hello,

I would like to combine any overlapping/touching lines into one long simple geometric line.

So far, what I could obtained is an aggregated geometry doing this

  • Intersector
  • NetworkTopologyCalculator
  • Aggregator

AFter this task, I would like to extract the starting and ending vertices of the resulting lines and it fail when I used the VertexRemover because the resulting geometry is a multiple geometry (multicurve).

Any ideas?

icon

Best answer by jdh 17 May 2019, 17:57

View original

12 replies

Badge +22

Why not just use a LineCombiner?

Userlevel 4

The problem is that the Aggregator doesn't join the line segments, it only groups them together in an aggregate (multi-part) geometry.

I agree with @jdh concerning the LineCombiner, however it may be a problem when you have several segments that aren't connected in a very simple, single line (e.g. intersections, junctions, etc)

Badge +1

Why not just use a LineCombiner?

@jdh, I tried but I can't have the expected results.

As @david_r already pointed out, I have several cases where the lines are not connected.

For instance, if I have the lines AB and CD that overlapping on the CB, how should I proceed to obtain a simple geometric line AD?

 

Badge +22

Using the Snapper in Segment Mode should help with that.

Badge +22

@jdh, I tried but I can't have the expected results.

As @david_r already pointed out, I have several cases where the lines are not connected.

For instance, if I have the lines AB and CD that overlapping on the CB, how should I proceed to obtain a simple geometric line AD?

 

Using the Snapper in Segment Mode should help with that.

Badge +1

Using the Snapper in Segment Mode should help with that.

The overlapping distance could be very big or very small and the issue that I have with the snapper is to define the snapping distance so that it could automatically merge the lines AB, CD into AD.

Badge +22

The overlapping distance could be very big or very small and the issue that I have with the snapper is to define the snapping distance so that it could automatically merge the lines AB, CD into AD.

In segment mode, it's not the distance between vertex B and Vertex C, it's the the distance of vertex B to any point along the segment CD and vice versa.

 

 

You would end up with line ACB and line CBD, which would have an overlap of CB.

 

As long as the LineCombiner in in Vertex Noded rather than End node, that is not a problem.
Badge +1

In segment mode, it's not the distance between vertex B and Vertex C, it's the the distance of vertex B to any point along the segment CD and vice versa.

 

 

You would end up with line ACB and line CBD, which would have an overlap of CB.

 

As long as the LineCombiner in in Vertex Noded rather than End node, that is not a problem.

Thanks @jdh.

 

To ensure that the line will be merged, I added a densifier before using the snapper.
Badge +1

Thanks @jdh.

 

To ensure that the line will be merged, I added a densifier before using the snapper.

@jdh

A through analysis of the results shows that there are some cases where overlapping lines were not merged.

Badge +22

@jdh

A through analysis of the results shows that there are some cases where overlapping lines were not merged.

Without having a sample of the problem geometry, it will be hard to troubleshoot.

Userlevel 4

The overlapping distance could be very big or very small and the issue that I have with the snapper is to define the snapping distance so that it could automatically merge the lines AB, CD into AD.

If you have a common attribute on the lines to join, you should use it as a Group By on the Snapper, that way you should have no false joins.

Badge +1

If you have a common attribute on the lines to join, you should use it as a Group By on the Snapper, that way you should have no false joins.

@david_r

Unfortunately, there is not a common attribute on the lines to be joined.

They have to be joined based only when one touches/overlaps another.

Reply