I have two point layers,name "1" and name "2",The points in layer 2 have some offset relative to layer 1. enter image description here

I want to generate a field to display the angle at which the points in layer 2 are offset from layer 1. like this:

enter image description here

How should I operate it.

  • 1
    How do you know which point from layer 2 should be used for a point on layer 1? Mar 4 at 7:55
  • Adjacent points
    – smilecc
    Mar 4 at 8:49

1 Answer 1


This will search for the nearest point within 1000 m (the unit of my crs is meters), and calculate the azimuth:

azimuth(point_a:=$geometry, point_b:=
overlay_nearest( layer:='secondlayer', 
expression:=$geometry, limit:=1, max_distance:=1000)[0])))

If you want to create a field with the value you can use Field Calculator. I just label the points using the expression:

enter image description here

  • 1
    If you need to take the ellipsoid and CRS in account, you can also use the bearing function (new since QGIS 3.34.0): bearing(point_a,point_b[,source_crs][,ellipsoid])
    – eurojam
    Mar 4 at 12:52

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.