Skip to main content
Question

snapping line end vertex to nearest point


Hello

 

 

I have a number of connectors which touch a main line but do not split it.  I want to be able to select the connectors that are not currently attached to a node and snap their vertex to the closest node point as shown by red dashed lines.  I assume I have to form a relationship between the connectors and the main line and then the main line and the node points?  Or can it just be undertaken using X,Y co-ordinates and proximity.

 

 

Any help greatly appreciated.

 

 

 

 

 

6 replies

david_r
Evangelist
  • July 17, 2015
Hi

 

 

A couple of suggestions:

 

 

1) Use the AnchoredSnapper with a high tolerance and the nodes as anchors, with snapping type set to endpoint snapping.

 

 

2) You can use the TopologyBuilder to find lines that aren't connected to a node on both ends, check the attributes _from_node and _to_node. Then use a NeighborFinder to find the closest node. The coordinates of the closes node will be available in _closest_candidate_x and _closest_candidate_y.

 

 

David

cnero101
Contributor
Forum|alt.badge.img+5
  • Contributor
  • November 29, 2022
david_r wrote:
Hi

 

 

A couple of suggestions:

 

 

1) Use the AnchoredSnapper with a high tolerance and the nodes as anchors, with snapping type set to endpoint snapping.

 

 

2) You can use the TopologyBuilder to find lines that aren't connected to a node on both ends, check the attributes _from_node and _to_node. Then use a NeighborFinder to find the closest node. The coordinates of the closes node will be available in _closest_candidate_x and _closest_candidate_y.

 

 

David

Hi David, I am having some issues with this snapping

 


Forum|alt.badge.img+2
  • November 29, 2022

@tt​ if you can include a small sample dataset then community members can experiment with your data.


cnero101
Contributor
Forum|alt.badge.img+5
  • Contributor
  • December 1, 2022
markatsafe wrote:

@tt​ if you can include a small sample dataset then community members can experiment with your data.

I would like to know when you are online so that we can a real time chat on this

 


cnero101
Contributor
Forum|alt.badge.img+5
  • Contributor
  • December 1, 2022
david_r wrote:
Hi

 

 

A couple of suggestions:

 

 

1) Use the AnchoredSnapper with a high tolerance and the nodes as anchors, with snapping type set to endpoint snapping.

 

 

2) You can use the TopologyBuilder to find lines that aren't connected to a node on both ends, check the attributes _from_node and _to_node. Then use a NeighborFinder to find the closest node. The coordinates of the closes node will be available in _closest_candidate_x and _closest_candidate_y.

 

 

David

I would love to know more about this as I have a similar situation right now and I am having some difficulties


cnero101
Contributor
Forum|alt.badge.img+5
  • Contributor
  • December 1, 2022
markatsafe wrote:

@tt​ if you can include a small sample dataset then community members can experiment with your data.

In my own case I have points and lines, I want to snap the lines to the points, both edges, ends and sides. I tried using the snapper and also tried using the anchored snapper, but still don't get to snap some. I have used intersector, it does the major part of the snapping but creates new points at any intersection without a point. I really would love to do this snapping based on relationship (attribute)


Reply


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