I have this scenario :

enter image description here

These are 2 different layers, each square has points at the corner, and the goal is to have the points of each square at the same exact location with a good accuracy (if you zoom a bit they will still be at the same location).

Right now on Qgis I have to move the point from red square to the location of the point of black square, then I have to zoom and move it again (because it won't be at the same exact location), and do this again multiples times until it's good enough. I don't want to remove any point though or merge the 2 layers, I just want the points to be at the same location with a good precision.

Is there a way to merge them easily to have them at the same location ?

(and avoid this stupid thing to move a point to the location of other point, zoom, move it again...and so on)

Or maybe is it possible to select the 2 points and move them together to the same location (like that they will be at the same location)

Here is a more detailed explanation : enter image description here As you can see, all the layers are different, they don't have the same form, they can be very big or very small. In reality it's rare there are lines for the shape of layers but it was easier to draw it this way. Each project is different, so it won't be the same position for the different layers, the form will be a bit different and so on, there won't be the same amount of layers, but it is always the same goal.

The goal is to have all the points of the layers, next to each other, be at the exact same position, except the ones which are "outside"(not close to another point)

I thought about it and I guess the easiest algorithm would be :

  • Go have the whole lists of points of the project
  • Check all the points which aren't from the same layer nearby (random number example, all the points < 50 pixels), and snap to the closest one. If no snap, add one to counter
  • Go to the next point, and redo the same

At the end you will know how many points didn't snap so you can check manually why (it should be the number points at the "outside" of the map, if not, there was an issue somewhere). Do not worry if you can't do that because the snap solution is already amazing. I'll look into it later when I have time if no solution is found yet, I'll try to find one and post it here if I success in doing it but I have doubt since I never did PyQGIS code before and maybe you can't even do this idea (because for example you can't get all the points and their layer identity, or for other reasons).

  • 1
    If you need to deal with many points, I can provide a solution using some (simple and easy to use) PyQGIS code: could it be of interest?
    – mgri
    Commented Apr 29, 2017 at 9:26
  • I would love to hear it ! I have to do it for a lot of points so... Thanks for help. It won't be an issue to use some pyqgis code (I know dev a bit) . Just for information, I can't try any solution before tuesday.
    – Masa
    Commented Apr 29, 2017 at 21:00
  • I will try to give you a help. Please, describe the rules to use for accomplish the task (maybe editing the original question and attaching some images): do you want to always snap the point on the left to the point on the right? Are you dealing with geometries which are similar (for the shape and the reciprocal postion) to the ones provided in the attached image? Please, be the most detailed possibile for explaining the issue.
    – mgri
    Commented Apr 29, 2017 at 21:46
  • Here is a more detailed explanation, do not hesitate to tell me if I forgot an information you need or you don't understand something. I really appreciate it, thank you very much, that's very kind of you.
    – Masa
    Commented Apr 30, 2017 at 7:16
  • thanks. Some other crucial things: the layer is a line or a polygon layer? All the shapes in the attached image belong to the same layer or each color represents a different layer? , if I have 3 nearby points, I can arbitrarily snap them to any point of them?
    – mgri
    Commented Apr 30, 2017 at 11:11

1 Answer 1


You can activate snapping through Settings/Options/Digitizing

Under this tab you can check the "Open snapping options in a dock window (QGIS restart required)" (This will allow you to modify snap settings easily in the future)

Play with the tolerance a little (I've done two separate shapes files with polygons to test and put the tolerance at 0.01) and be sure to apply the Layer selection to "All visible layers" and Snap to "Vertex" then you should be good to go.

  • 1
    Using snapping would be a good solution (dealing with few points), but the value to set for the tolerance is related to the units of measurement of the QGIS project, so it should be chosen with reference to the specific case. However, +1 for me.
    – mgri
    Commented Apr 29, 2017 at 9:22

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.