Skip to content Skip to sidebar Skip to footer

When Calcuating Distance Between Points On Earth Why Are My Haversine Vs. Geodesic Calculations Diverging?

I am getting wildly diverging distances using two approximations to calculate distance between points on Earth's surface. I am using the Haversine (vectorized) approximation and th

Solution 1:

The Haversine formula calculates distances between points on a sphere (the great-circle distance), as does geopy.distance.great_circle.

On the other hand, geopy.distance.geodesic calculates distances between points on an ellipsoidal model of the earth, which you can think of as a "flattened" sphere.

The difference isn't due to rounding so much as they use different formulas, with the geodesic formula more accurately modeling the true shape of the earth.

Solution 2:

There was a matrix algebra error in the Haversine formula. I updated the code in the question. I am getting much better agreement between Haversine and geodesic now:

enter image description here

On my actual dataset:

enter image description hereenter image description here

Post a Comment for "When Calcuating Distance Between Points On Earth Why Are My Haversine Vs. Geodesic Calculations Diverging?"