Use geographiclib package for python. It calculates distances and bearings on an ellipsoid and much more. (You can interpolate paths, measure areas, etc.) For example, after
pip install geographiclib
You can do
>>> from geographiclib.geodesic import Geodesic >>> Geodesic.WGS84.Inverse(-41.32, 174.81, 40.96, -5.50) {'lat1': -41.32, 'a12': 179.6197069334283, 's12': 19959679.26735382, 'lat2': 40.96, 'azi2': 18.825195123248392, 'azi1': 161.06766998615882, 'lon1': 174.81, 'lon2': -5.5}
It computes surveying from Wellington, New Zealand (41.32S 174.81E) to Salamanca, Spain (40.96N 5.50W). The distance is given s12 (19959679 meters), and the initial bearing (bearing) is set to azi1 (161.067 ... degrees clockwise from the north).
source share