I have reviewed Why is law of cosines more preferable than haversine when calculating distance between two latitude-longitude points? and that does not equate to the specific question that I wish to ask because I'm looking for a simple answer about accuracy of multiple formulas. While there is an answer there that discusses accuracy, it does it more as a comparison between two methods and depends on the reader understanding trigonometry to follow the answer. I'm looking, mostly, for simple margins of error.

This is my first time trying to compute distance from two points on the ground. I've been researching this and see that a lot of people use the Haversine Formula, but I also see comments, whenever I read about it, that there are accuracy issues. Apparently, from what I see, Vincenty is more accurate, but I've also seen comments that the Law of Cosines is better.

What I don't see is any way to find out just how inaccurate I can expect a method to be. Apparently there can be problems at extremely small distances in Haversine, but I'm not clear on that.

I'd like to just go on and use GeoPy in my program. I'm basically working with distances of 100 miles or less. Most of the time I'm comparing coordinates of two locations to see if they're close enough to be considered the same address. If the accuracy is going to be within a few feet, that's close enough.

Can someone either point to a good resource or explain what kind of accuracy I can expect from the different methods I've mentioned and if there's a way to know what the conditions are that will give me more or less accurate answers?

I do see that GeoPy has a feature to tell me the confidence of a calculation, but I need to be able to know, in general, what kind of accuracy I can get from any one method overall, not for each individual calculation.

I see a lot about one method being better than another, but I don't see much on what kind of accuracy I can expect from any one method and what factors I can look at to tell me how accurate that method is. That's what I'd like help finding.


1 Answer 1



  • The word accuracy carries different meanings in Survey Engineering and in GIS even though both are related. In the former, it is explained here. In the latter, it was discussed here.
  • Position (i.e., coordinates) on the ground is never exact. The determination of a position on the ground will always produce some margin of errors (i.e., also known as the horizontal and vertical precisions). Hence, when the same position is transferred into GIS, it also carry the same errors. However, the error values are (almost always) never recorded in the GIS. And over time, as the GIS data (i.e., positions) get passed from hands to hands, the error values got lost. It is important to keep in mind that all coordinates in GIS carry implied errors.
  • In GIS, it is ambiguous to just state that you require accuracy. You actually need to state that you require a certain level of accuracy, e.g., at decameter-level, or meter-level, or at decimeter-level or at centimeter-level, and etc. For e.g., for showing the location of a typhon in GIS, you don't need centimeter-level accuracy. But the irony is that GIS records any position up to micro-meter level.

The Answers

  • The discussions in "Why is law of cosines more preferable than haversine when calculating distance between two latitude-longitude points?" were done in the context of the earth as a sphere. The latitudes on a sphere are geocentric latitudes.

  • However, ground coordinates are always geodetic coordinates on an ellipsoid. Hence, the latitudes on an ellipsoid are geodetic latitudes. This is implied, seldom mentioned in explicit, and is a source of major confusion and erroneous calculations for the general as well as seasoned GIS users.

    In the above figure (Copyright Wikipedia), PAB is a geocentric latitude on an ellipsoid (60 deg), while PCB is a geodetic latitude on the same ellipsoid (66 deg). Note that geodetic latitudes are always larger than geocentric latitudes except at the Equator and at the Poles where they are equal. This Wikipedia link explains the many types of latitude.

  • In the above-stated URL (i.e., plain Cosine-vs-Haversine), they were discussing the merits of the plain Law of Cosines over the Haversine formula. Both are formulas for the sphere. You should never (ever) apply spherical formulas on geodetic coordinates. Period.

  • Meanwhile, the Vincenty formula is time-tested and proven to compute "accurate" geodesic between two geodetic coordinates on an ellipsoid.

Misc Answers

  • Applying spherical formulas on geodetic coordinates is the biggest and most common mistakes today. Google Maps was the biggest culprit. In this forum itself, erroneous answers can be traced back as far as six to seven years.

  • GeoPy deprecated Vincenty since v1.13 and will remove it in v2.0 - not because Vincenty is inaccurate, but mainly because it was superseeded by the newer Karney formulas. Vincenty will fail if two geodetic coordinates are nearly antipodal, whereas Karney doesn't have this problem. All said, it is still perfectly OK to continue to use Vincenty.

  • The Questioner may wish to revisit his understanding about the "accuracy" of the GIS points that represent addresses. For e.g., does a point refers to the centroid of a building footprint, or the centroid of a piece land, and etc. In real life, no building or land is ever a point on earth.


Thus far, the observant readers may (have) noticed that my answer had been silent on the fact that it is also incorrect to apply spherical formulas on any ellipsoids. This omission is deliberate and the explanation is as below.

  • If the coordinates on an ellipsoid were geocentric and not geodetic - then the (spherical) Haversine formula would give outputs "nearing" but never equal the correct answer. The delta will always be some distance + some ppm. Meaning, the further the geodesic distance between the two coordinates on the ellipsoid - the larger the delta between the correct answer and Haversine's output. Some Users can accept the delta magnitude because the data points are all close to each other, or they have low horizontal precision. But this is an erroneous decision nevertheless.

  • But the fact remains - ground coordinates are (almost) never geocentric, but geodetic. This, plus the previous statement, together explain why Haversine appeared to give "good" result when two geodetic coordinates are "near", but give "unsatisfactory" result when "far".

Remember - the lats and longs we get are geodetic. And applying spherical formulas (like the Haversine) on geodetic coordinates is a double whamy we could all avoid.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.