Haversine Distance
Haversine Distance Metric · Also known as: great-circle distance, haversine formula
Haversine distance measures the great-circle distance between two points on a sphere given their latitude and longitude coordinates. Popularized by Roger Sinnott in 1984, this formula computes the shortest distance between two points on Earth's surface, accounting for the planet's spherical geometry. It ranges from 0 (identical locations) to half the Earth's circumference. Haversine is essential for geographic information systems (GIS), location-based services, and spatial analysis.
Read the full method
Sign in with a free account to read this section.
When to use it
Haversine distance is ideal for geographic and location-based applications: mapping, geolocation services, proximity searches, and spatial analysis. Use it for distances up to thousands of kilometers where Earth's curvature matters but the more complex Vincenty formula is not necessary. For higher precision (especially at very long distances or polar regions), consider Vincenty distance. Not suitable for points in local Cartesian coordinate systems.
Strengths & limitations
- Numerically stable: uses the haversine function to avoid the errors of naive law-of-cosines formula
- Intuitive geographic interpretation: measures actual distance along Earth's surface
- Computationally efficient: requires only basic trigonometric operations
- Widely adopted in GIS, web mapping libraries (e.g., Leaflet), and location-based applications
- Assumes spherical Earth; ignores ellipsoidal shape and local topography
- Approximation error increases with distance; Vincenty formula is more accurate for long distances
- Cannot be applied directly to non-geographic coordinate systems
- Does not account for altitude or 3D coordinates (latitude, longitude only)
Frequently asked
How accurate is haversine distance?
Haversine is accurate to within about 0.5% for distances on Earth using Earth's mean radius (6371 km). The error increases slightly at the poles due to Earth's oblate spheroid shape. For higher precision (error < 0.1%), use Vincenty distance formula.
What Earth radius should I use?
The commonly used value is 6371 km (mean radius). Equatorial radius is 6378 km, polar radius is 6357 km. For most applications, the mean radius is appropriate; use equatorial or polar for high-precision work in specific regions.
Can haversine handle wrap-around at the date line or poles?
Yes. The formula handles latitude/longitude wrapping naturally due to its trigonometric foundations. Longitude wraps at ±180°; the formula automatically finds the shortest arc.
Is haversine faster than Vincenty distance?
Yes. Haversine uses simpler trigonometric operations; Vincenty iterative method is slower but more precise. Choose haversine for speed and moderate accuracy; choose Vincenty when precision matters more than speed.
Sources
How to cite this page
ScholarGate. (2026, June 3). Haversine Distance Metric. ScholarGate. https://scholargate.app/en/decision-making/haversine-distance