According to the QgsDistanceArea
docs, an azimuth for computeSpheroidProject
should be:
in radians, clockwise from North
So, to build a new point with computeSpheroidProject
I use math.radians(azimuth)
pt1 = QgsPointXY(30.30, 60.60)
distance = 100
azimuth = 45
da = QgsDistanceArea()
da.setEllipsoid('WGS84')
pt2 = da.computeSpheroidProject(pt1, distance, math.radians(azimuth))
print(pt1, pt2)
>>><QgsPointXY: POINT(30.30000000000000071 60.60000000000000142)>
<QgsPointXY: POINT(30.30129068361398836 60.6006346117680792)>
But when needed to find an azimuth
between pt1
and pt2
it doesn't return the original value (45):
azimuth = pt1.azimuth(pt2)
print(azimuth)
>>>63.81727521235025
Looks like I haven't quite figured out azimuth calculations. Why results are different?
pt1
andpt2
in field calculator:degrees( azimuth( make_point(30.30000000000000071, 60.60000000000000142), make_point(30.30129068361398836, 60.6006346117680792) ) )
It also results in 63.81727521235025distance = da.measureLine(pt1, pt2)
) is 99.99999997504422. So the distance is measured properly, as opposed to the azimuth