In QGIS 3.10 I am calculating the azimuth between two points whose position is defined in WGS84 coordinates. If I Open Attribute Table -> Open Field Calculator and ask for
degrees(
azimuth(
make_point(6.020323,47.248690),
make_point(6.083703,47.242157)
)
)
I get 95.885° degrees which is inconsistent with the manual calculation:
atan2(sin(delta_lon)*cos(lat2), cos(lat1)*sin(lat2)-sin(lat1)*cos(lat2)*cos(delta_lon))
or with the result provided by the French Geographic Institute (Géoportail) website.
However, if following Azimuth calculation, extending lines I run in the Python Console:
p1 = QgsPointXY(6.020323,47.248690)
p2 = QgsPointXY(6.083703,47.242157)
d = QgsDistanceArea()
d.setEllipsoid('WGS84')
d.bearing(p1,p2)*180/3.1415926535
then I get the correct result of 98.584. Could someone enlighten me as to why the first method provides an erroneous result?