Solved

Snapping one line to another

  • 28 November 2022
  • 6 replies
  • 34 views

Badge +7

What transformer can I use to snap the red line to the black line keeping the intersection point (blue circles) in place? Anchored Snapper would snap the edges but shortens the red line while Affine Warper works only for short lines. Thanks!

image

icon

Best answer by dustin 28 November 2022, 12:42

View original

6 replies

Userlevel 3
Badge +26

What is the geometry type of the black line? If it's an arc, I think you will find it difficult to actually snap the red line. A work-around I've used in the past has been to clip the geometry of the black line using the intersecting blue points (Intersector or PointOnLineOverlayer), identify the section of black line geometry you want to keep somehow (NeighborFinder?), and then use that geometry instead of trying to force move the red line. If you can successfully isolate the geometry of the black line, you can store it to an attribute using the GeometryExtractor, then transfer that attribute to the red line, where you can rebuild the geometry using the GeometryReplacer.

Badge +7

What is the geometry type of the black line? If it's an arc, I think you will find it difficult to actually snap the red line. A work-around I've used in the past has been to clip the geometry of the black line using the intersecting blue points (Intersector or PointOnLineOverlayer), identify the section of black line geometry you want to keep somehow (NeighborFinder?), and then use that geometry instead of trying to force move the red line. If you can successfully isolate the geometry of the black line, you can store it to an attribute using the GeometryExtractor, then transfer that attribute to the red line, where you can rebuild the geometry using the GeometryReplacer.

Thanks for the quick reply. The black line is made of connected vertices separated 1 meter apart. I also tried your workaround by clipping the black line and giving the red line's attribute into it using Neighborfinder. But I encounter a problem when several red lines overlap. I haven't found a way to clip the black line using the intersection of the first red line, store it, then clip the original black line using the intersection of the second red line and then store the feature. This would definitely solve my problem.

Userlevel 3
Badge +26

Thanks for the quick reply. The black line is made of connected vertices separated 1 meter apart. I also tried your workaround by clipping the black line and giving the red line's attribute into it using Neighborfinder. But I encounter a problem when several red lines overlap. I haven't found a way to clip the black line using the intersection of the first red line, store it, then clip the original black line using the intersection of the second red line and then store the feature. This would definitely solve my problem.

Hmm, I wonder if it's the lack of vertices in the red line causing the issue on the longer lines. What if you tried a Densifier on the red lines before the AnchoredSnapper? You may have to play with the number of verts to add.

Badge +7

Thanks for the quick reply. The black line is made of connected vertices separated 1 meter apart. I also tried your workaround by clipping the black line and giving the red line's attribute into it using Neighborfinder. But I encounter a problem when several red lines overlap. I haven't found a way to clip the black line using the intersection of the first red line, store it, then clip the original black line using the intersection of the second red line and then store the feature. This would definitely solve my problem.

Brilliant! Adding a Densifier did the trick! Thank you so much!

Thanks for the quick reply. The black line is made of connected vertices separated 1 meter apart. I also tried your workaround by clipping the black line and giving the red line's attribute into it using Neighborfinder. But I encounter a problem when several red lines overlap. I haven't found a way to clip the black line using the intersection of the first red line, store it, then clip the original black line using the intersection of the second red line and then store the feature. This would definitely solve my problem.

I am having some issues similar to this, 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)

Badge +7

Thanks for the quick reply. The black line is made of connected vertices separated 1 meter apart. I also tried your workaround by clipping the black line and giving the red line's attribute into it using Neighborfinder. But I encounter a problem when several red lines overlap. I haven't found a way to clip the black line using the intersection of the first red line, store it, then clip the original black line using the intersection of the second red line and then store the feature. This would definitely solve my problem.

If you can illustrate what you are trying to achieve, perhaps people from the community could help. I am sure someone in the community knows the right answer to what you are trying to do. As to snapping based on an attribute, you can use "Group By" when you do the snapping.

Reply