Question

snap points to lines end nodes

  • 28 January 2014
  • 3 replies
  • 3 views

Badge
Morning All, 

 

 

I am trying to correct a stormwater network. I have pipes and catchpits, some are snapped and some are not. I which to snap the unsnapped catchpits to the end of the pipes that dont already have a catchpti snapped to it. . 

 

 

How do i make sure im not snapping a catchpit to a pipe with already a catchpit snapped to it, and how do i ensure that im snapping the closest catchpit to the line not some other catchpit thats inside the Max distance ?

 

 

I have tried using spatail relators TOUCHES where the count of the line nodes related candiates = 0 but i end up  snapping multipule catchpits to one end of a line when using the Anchor snapper. 

 

 

Is there a better method im missing ?

 

 

Thanks Steve

 

 

 

 

 


3 replies

Badge
Assuming the Catchpits are point features (although it doesn't really matter) you can use a NeighborFinder transformer. Use the Pipes routed to the Base port and the Catchpits routed to the Candidate port.

 

 

The documentation is pretty thorough so readup on the detials of that transformer but basically just "recreate" the points with a 2DPointReplacer (or 3D) once they've "snapped" to the nearest Pipe. All the attributes remain and you'll have your nearest point snapped.

 

 

You specified you only want to snap those features that don't have a Catchpit already snapped to it. Well, without seeing your data, I would recommend using a TestFilter and sending only those featurs that don't have a snapped Catchpit down one stream and runnign the NeighborFinder transformer on that branch only. Then once everything is snapped, merge the streams back together.
Badge
Thanks for your tips. I went with two neighborFinders. 

 

 

1) turned lines to first and last nodes

 

2) used neighbour finder where max distance was 0

 

3) removed these catchpits and line nodes from the set

 

4)used second neighbour finder set to 5m to move catchpits to candidate_x and y 

 

 

worked like a charm. 

 

 

thanks steve
Userlevel 2
Badge +17
Hi Steve,

 

 

Good to hear you got a solution.

 

One more tip. If you sent the nodes to Base port and sent the catchpits to Candidate port of the 2nd NeighborFinder, every output node from Matched port would have all attributes of the closest catchpit. It means that you could use them as "snapped catchpits" immediately (no need to move catchpits).

 

 

Takashi

Reply