geographiclib / geographiclib-python

Python implementation of the geodesic routines
MIT License
42 stars 5 forks source link

Negative azimuth to west #4

Closed rodegerdts closed 2 days ago

rodegerdts commented 2 days ago

In the documentation it says that azimuth is measured clockwise from north. This seems not to be the case. To me it looks like westerly azimuth (more than 180 degrees is measured counterclockwise negative from north:

from geographiclib.geodesic import Geodesic
geod = Geodesic.WGS84 
print(geod.Inverse(67.0, 14.0, 66.0, 13.9)["azi1"])
-177.6682183229172
print(geod.Inverse(67.0, 14.0, 66.0, 14.1)["azi1"])
177.6682183229172

Is this intended? I was expecting something around 182.4 from the first statement. Or is there something I am missing?

cffk commented 2 days ago

This is the intended result. GeographicLib treats 182 degrees and -178 degrees as equivalent (they differ by a multiple of 360 degrees). The result returned is in the range [-180, 180] degrees because this gives the greatest precision.

rodegerdts commented 2 days ago

OK I was suspecting as much. Just unexpected. Thanks for the clarification.