Question

snapping line end vertex to nearest point

  • 17 July 2015
  • 6 replies
  • 23 views

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

Userlevel 4
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

 

 

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

 

Badge +2

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

@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

 

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

@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