Glossary

Haversine Distance Formula

A formula that calculates the great-circle distance between two points on Earth's surface using their latitude and longitude coordinates. WorthThePump uses the Haversine formula to measure how far each petrol station is from your current location.

Direct Answer / TL;DR

What is Haversine Distance Formula?

A formula that calculates the great-circle distance between two points on Earth's surface using their latitude and longitude coordinates. WorthThePump uses the Haversine formula to measure how far each petrol station is from your current location.

Why does it matter for UK drivers?

The Haversine formula is named after the 'haversine' trigonometric function (half of the versed sine). It's used to compute the shortest distance between two points on a sphere — in this case, the surface of the Earth.

The formula: a = sin²(Δlat/2) + cos(lat1) × cos(lat2) × sin²(Δlon/2); c = 2 × atan2(√a, √(1-a)); d = R × c. Where R is Earth's mean radius (6,371 km) and lat/lon are in radians.

The Haversine distance is a straight-line 'as the crow flies' measurement. It doesn't account for roads, traffic, or routing. Road distance is typically 20–40% longer than Haversine distance in the UK, depending on the road network. In rural areas with winding roads, the multiplier can be even higher.

WorthThePump uses Haversine distance as a practical approximation for two reasons: (1) it's computationally fast — calculating road distances for 500+ stations simultaneously using a routing API would be extremely slow and expensive; (2) it's directionally correct — if Station A is 1 mile Haversine distance and Station B is 5 miles Haversine distance, Station A will almost always be closer by road too.

The practical implication is that WorthThePump's detour cost estimates are slightly optimistic (the actual road distance will be longer). The real-world detour to a station may cost 20–30% more than calculated. We apply a conservative approach: if it's a borderline case, factor in that the true road distance is probably a bit further.

For precise routing, Google Maps Directions API or HERE API would provide road distances — but these add latency, cost, and API key dependencies. Haversine distance is the right trade-off for a calculator that needs to rank hundreds of stations instantly.

Related terms

Further reading

Now you know what Haversine Distance Formula means —

find out if your nearest cheap station is actually worth the trip.