In QGIS 3.28.3 and i have layers A and B (both contain only points) and I want to move the points in layer B to the nearest point in layer A, under the following conditions:

  • The points must have the same name and the nearest distance
  • The range should be 10 km only
  • That the other points that do not match remain the same

Ex: enter image description here enter image description here

I tried "Snap Vertices to Nearest Points by Condition" and "Join attributes by nearest with condition" From ProcessX but I don't know the correct way to use it, do you have solutions for this problem?

  • 1
    Have a look at overlay nearest. The crux is grabbing the geometry info from the nearest point with the same value in order to change the geometry of the current feature.
    – Erik
    Commented Feb 23, 2023 at 13:14

1 Answer 1


If I understand your question correctly, Snap Vertices to Nearest Points by Condition should actually do just that.

Set it up the following:

  • Source Layer: layerB
  • Points Layer: layerA
  • Snap Vertices: Simply choose all options
  • Snap to one and the same point more than once: Use a point as often as it is the nearest match
  • Maximum snapping distance: 10000
  • Compare-Expression for Source-Layer: your name field of layerB
  • Comparison operator: =
  • Compare-Expression for Points-Layer: your name field of layerA

Make sure your Source Layer is in a metric CRS. Then run it.

  • Thank you very much, I tried that and it worked for me Commented Feb 23, 2023 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.