1

I have been trying to use the azimuth expression function editor between 2 points. However, I am not getting it to work. I am obviously misunderstanding how to create the expression itself. This is what I have

=  degrees( azimuth( make_point( "PrefRef"  'TR 15 NW 100' ), make_point( "PrefRef"  'TR 15 NW 114' )))

PrefRef being the point label and ID.

Expression is invalid Error is Parser Error: syntax error, unexpected EQ

Eval Error: No root node! Parsing failed?

I am using QGIS 2.18

  • 1
    Remove the equal sign at the beginning and add a delimiter to your make_point function. e.g. make_point( "PrefRef", 'TR 15 NW 100' ). Also make_point does not accept a string as point. You have to enter coordinates as number or field e.g. make_point( "FieldContainingCoordinates", 13.44556677 ). – MrXsquared Nov 24 '19 at 12:50
0

Azimuth function needs two point geometries, but if you have point geometries in a layer you don't need to "make the points"; you can read the geometry of that features instead.

Assuming that you have a Point geometry type vector layer named 'points', and you want to know the azimuth betwwen the point geometry of the features of that layer that have the values 'TR 15 NW 100' and 'TR 15 NW 114' in the 'PrefRef' field, in degrees, you can use the following expression:

degrees(
  azimuth(
    geometry(
      get_feature(
        'points', 'PrefRef', 'TR 15 NW 100')),
    geometry(
      get_feature(
        'points', 'PrefRef', 'TR 15 NW 114'))))
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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