4 ms·
The basic answer is speed and accuracy. The approximations implemented here are within 0.1% of the Vincenty method for distances under 500km, which is useful i
by danpat 9y ago
The basic answer is speed and accuracy. The approximations implemented here are within 0.1% of the Vincenty method for distances under 500km, which is useful in all kinds of situations. The Haversine formula works for spheres, so it's not as accurate as the Vincenty method for the Earth (a flattened sphere), and it uses more trig functions than this approximation, so it's slower and less accurate for lon/lat distance calculations.
I work with Vlad (the author of the original Javascript https://github.com/mapbox/cheap-ruler https://github.com/mapbox/cheap-ruler). At the time it was created, we were basically just looking for the fastest method to get accurate distance calculations on lon/lat values within "short distances". Vlad found that this approximation fitted our needs well (i.e. the types of distances we typically needed to calculate distances for), and performed the best.
For really accurate measurements, you typically need to use a projection system that's targeted at the area you're measuring in. The earth isn't even a perfect flattened sphere, it's covered in lumps and bumps, so if you need really accurate measurements, you need to use one designed for the bump you're measuring on. Some great illustrations here: http://www.icsm.gov.au/mapping/datums1.html http://www.icsm.gov.au/mapping/datums1.html