Skip to main content
Solved

Combine overlapping/touching lines into one long simple geometric line


arthy
Contributor
Forum|alt.badge.img+8
  • Contributor

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?

Best answer by jdh

Using the Snapper in Segment Mode should help with that.

View original
Did this help you find an answer to your question?

12 replies

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • May 17, 2019

Why not just use a LineCombiner?


david_r
Evangelist
  • May 17, 2019

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)


arthy
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • May 17, 2019
jdh wrote:

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?

 


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • Best Answer
  • May 17, 2019

Using the Snapper in Segment Mode should help with that.


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • May 17, 2019
arthy wrote:

@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.


arthy
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • May 17, 2019
jdh wrote:

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.


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • May 17, 2019
arthy wrote:

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.

arthy
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • May 17, 2019
jdh wrote:

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.

arthy
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • May 17, 2019
arthy wrote:

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.


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • May 17, 2019
arthy wrote:

@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.


david_r
Evangelist
  • May 20, 2019
arthy wrote:

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.


arthy
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • May 20, 2019
david_r wrote:

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.


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