I’m wondering if QGIS has a tool to align the lat, long, and alt data of two point layers based on a common point. I have data like this:

Survey 1 points:


Survey 2 points:


I’d like to align Survey 2 to Survey 1 based on point C (i.e. Survey 2’s points would be translated so that point C is the same as Survey 1’s point C). The surveys were taken using an RTK rig. Is there a tool or plugin in QGIS that will do this?

I know from asking on Reddit that Affine Transform will do the translation, but I’m wondering if there’s a solution that I don’t have to calculate differences myself and therefore possibly make errors.

3 Answers 3

  1. Activate Snapping; in the icon in the middle, select All Layers.
  2. Select the Move Feature(s) tool.
  3. Select layer Survey 2 and select all features (Ctrl+A).
  4. Click once on the point C of Survey 2 and move it to the point C of Survey 1. Click again to release the point.

The point will snap to its peer and all other points from Survey 2 will be shifted accordingly.

Screenshot: Survey 2 = yellow points (all selected), shifted to Survey 1 (blue points). The red arrow shows the shift of point C (on the right), the other points will be shifted at the same angle and distance (blue arrows):

enter image description here

  • Will this also translate z-values?
    – peter
    Commented Jun 14 at 21:57
  • 2
    Where should the information for z-values come from? If they are based on an underlaying Digital elevation model, you can easily get this value from the DEM on the new position.
    – Babel
    Commented Jun 14 at 23:26
  • Thank you for your answer! The z-values in my case come from the surveyed points. This method plus affine transform for the z-values should work just fine, I’ll update when I have a chance to test it.
    – Skookum
    Commented Jun 20 at 14:09
  • I still don't understand what you mean. You want the z-value to be updated when you translate in x-/y-direction? How, based on what kind of information should QGIS know the new z-value? What does it represent? What does z-value stand for in your case and from what datasource should it be updated when you translate?
    – Babel
    Commented Jun 20 at 14:13

A PyQGIS solution. Tested on QGIS 3.34.6-Prizren.

Let's assume there are two point layers with surveying results i.e. 'Survey1' (greenish) and 'Survey2' (orangish), see the image below:


Proceed with Plugins > Python Console > Show Editor (Ctrl+Alt+P) and paste the scripts below with corresponding changes i.e. "Survey1" and "Survey2":

# imports
from qgis.core import QgsProject
from qgis.utils import iface

# accessing two layers of surveys
survey1 = QgsProject.instance().mapLayersByName("Survey1")[0]
survey2 = QgsProject.instance().mapLayersByName("Survey2")[0]

# defining the mutual field between two layers
mutualField = "type"

# a dict to store features id from survey2 and its new geometry from survey1
geomMap = {}

# looping over each feature in the survey2
for feat2 in survey2.getFeatures():
    # looping over each feature in the survey1
    for feat1 in survey1.getFeatures():
        # checking the condition between features based on the mutual field
        if feat2[mutual_field] == feat1[mutual_field]:
            # placing new values into the dict
            geomMap[feat2.id()] = feat1.geometry()

# accessing data provider of the survey2
provider = survey2.dataProvider()
# changing geometries in the survey2

# repainting the canvas map

Then press Run script run script and get the output like this:




You can use SQL and a Virtual Layer. This query should work if your ids are unique in each layer.

SELECT two.pointid, two.someattr, --Add all attributes you want to keep from Survey 2 layer here.
        WHEN one.geometry IS NOT NULL THEN one.geometry
        ELSE two.geometry
    END geometry

FROM "Survey 2" AS two
LEFT JOIN "Survey 1" AS one
ON two.pointid = one.pointid

Change Survey 2 and Survey 1 to match your layer names, add all attributes you want to keep from Survey 2 layer to the SELECT row, and change pointid to the name of your column with the A,B,.. ids.

The query will for each point in Survey 2, join any point in Survey 1 with a matching id/letter and if there is a match take its geometry, else keep the original geometry.

enter image description here

A new layer is created with the red points snapped to the green where the ids match. You can save the layer by right-click-Export

enter image description here

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.