language-agnosticgeospatiallatitude-longitudetrigonometry

Is the Haversine Formula or the Vincenty's Formula better for calculating distance?


Which is better for calculating the distance between two latitude/longitude points, The Haversine Formula or The Vincenty's Formula? Why?

The distance is obviously being calculated on Earth. Does WGS84 vs GCJ02 coordinates impact the calculation or distance (The Vincenty's formula takes the WGS84 axis into consideration)?

For example, in Android, the Haversine Formula is used in Google Map Utils, but the Vincenty Formula is used by the android.Location object (Location.distanceBetween()).


Solution

  • Haversine is a simpler computation but it does not provide the high accuracy Vincenty offers.

    Vincenty is more accurate but is also more computationally intensive and will therefore perform slower and increase battery usage.

    As with anything "better" is a matter of your particular application. For your application, Vincenty may be a "better" choice than Haversine, but for a different application, Haversine may be a better choice. You will have to look at the particulars of your use cases and make a determination based upon what you find there.