5

I measured the angle between two lines with Measure Angle. The result is 39.531°. In attribute table I used this script for calculating azimuth with Field Calculator:

degrees(azimuth(start_point($geometry), end_point($geometry)))

The result of Field Calculator is 46.62005°. Why are there different results?

Measure Angle:

Field Calculator:

Coordinates: Latitude1: 39.0390110 Longitude1: 33.8493433 Latitude2: 39.0413637 Longitude2: 33.8518330

  • Probably the two tools are using different CRS's. Check the description of the Azimuth function to see what CRS it uses (probably the layer's CRS). Check the Project Properties settings to see what CRS the measure tool uses. – csk Dec 22 '19 at 17:59
  • I also thought about this, I set the CRS to 4326 - WGS84 for layer and project. The result is the same. I don't know if one tool uses grad angle unit. The description: Returns the north-based azimuth as the angle in radians measured clockwise from the vertical on point_a to point_b. – Edip Ahmet Dec 22 '19 at 18:02
  • 2
    @EdipAhmet setting a CRS for a layer is bound to errors if transform is what you need! what is the datas initially defined CRS? 7 degrees is quite a reasonable margin of error if one method is getting the 'north' reference by math, and the second by drawing, and the CRS is based on e.g. different ellipsoids. – ThingumaBob Dec 22 '19 at 19:33
  • I guess 7 degrees error is the difference between true north and north. – zlikotp Dec 22 '19 at 23:47
  • 1
    Yes I also suspected this. I am a surveyor and we use bearing. I couldn't find any answer for calculation of bearing. The line is 160 meters, I think there shouldn't be a big difference like 7 degrees with true north and rectangular north. I will try projected crs like 3 or 6 zone UTM. I will upload the project here. – Edip Ahmet Dec 23 '19 at 16:07
3

After changing coordinate reference systems of line layer and project to TM 36N ED50 (projected coordinate system), I recalculated it again. Now azimuth angle and measured angle are the same. I used WGS84 geographic global coordinate system before. Because of the north of global coordinate system is different from metric local coordinate system, there was 7° difference between measured angle and calculated azimuth.

1

If you want the angle of the line and you have a simple line I would recommend using line_interpolate_angle instead of azimuth.

-1

azimuth function is the angle between the axis of your polyline and the north.

  • Yes, I draw another line as rectangular, assumed as North. I also tested the results with cosinekitty.com/compass.html site, the results were same as "Measure Angle". And these lines are single lines. – Edip Ahmet Dec 22 '19 at 17:32
  • can you check In Project menu, Porperties, General tab, Measurements – zlikotp Dec 22 '19 at 23:21
  • The distance measurement is meter, angle is in decimal degrees. – Edip Ahmet Dec 23 '19 at 16:11

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.