Question

How to merge the closest end or node of a line to a single point?

  • 18 February 2020
  • 3 replies
  • 55 views

Badge +4

Hi,

 

I'm trying to practice with spatial thinking, and I have a set of lines that I want to merge to a single point in the middle (see attached). The way I want to these lines merge into the point, is to use the nearest point of the line to the point in the middle of all the lines, and making the lines longer than they were previously, not just snapping them and moving them.


3 replies

Userlevel 3
Badge +17

Hi @armando_amador, after snapping, you can use the LineCombiner to connect lines to form a longer one. However, all the lines cannot be connected into a single line since the snapped lines would be branched more than two directions at the center point. Pairs of two lines can be connected in your example. Which pairs should be connected?

Userlevel 5

Have you tried the AnchoredSnapper with the point as the anchor and the lines as the candidates? Be sure to set the snapping type to "End point snapping". You can also play with the setting of "add additional vertex" according to your needs.

Badge +4

Hi guys!

I finally found the solution (but I still think I used a lot of transformers), and the result was what I was expecting.

 

I used the Snapper to set a distance value which came from the attribute "_distance" from the NeighborFinder's resulting table. The Snapping Distance relates to the higher value from one of the 6 vertex surrounding the center.

I think that I will try the AnchoredSnapper by @david_r suggestion makes the same as the Snapper due it uses the Snapping Distance to set the snapping, but it is also a great suggestion.

@takashi, used your tricks from another user's question to apply them to another steps in this practice, thank you!

Reply