Maps and geodesy

Distance and bearing between two coordinates

Geodesic distance, initial and final bearing and midpoint between two latitude/longitude points on the WGS84 ellipsoid, with the haversine great-circle result for comparison.

Runs in your browser. What you enter stays on this page and is not uploaded.

Decimal degrees (51.4778, -0.0015) or degrees, minutes and seconds (51°28′40″N, 0°0′5″W).

Showing the worked example. Results update as you type.

Result

Distance on WGS84 (Karney)19,959.679 km19,959,679.267 m · 12,402.370 mi · 10,777.365 nmi
Initial bearing161.067670° (SSE)true north, clockwise
Final bearing at the destination18.825195° (NNE)back bearing 198.825195°
Midpoint along the geodesic-45.711465, -32.898845
Haversine (sphere, R = 6,371.0088 km)19,967.404 km+7,724.3 m (0.0387%) from the geodesic; initial bearing 146.9342°
Arc length179.61970693°on the auxiliary sphere

Method and limits

Distances and bearings use Karney’s algorithms for geodesics on the WGS84 ellipsoid (a = 6,378,137 m, f = 1/298.257223563), through the GeographicLib JavaScript library. They are accurate to about 15 nanometres for any pair of points, including nearly antipodal ones where Vincenty’s iteration fails to converge. The initial bearing is the direction to set off in, clockwise from true north; the final bearing is the direction of travel on arrival, which differs because a geodesic is not a line of constant bearing. The midpoint is halfway along the geodesic.

For comparison, the haversine formula gives the great-circle distance on a sphere of mean radius R = 6,371.0088 km:

a = sin²(Δφ/2) + cos φ1 cos φ2 sin²(Δλ/2), d = 2R · asin(√a)

It is simple and fast but treats the Earth as round, so it can be off by up to about 0.5%.

Worked example (GeographicLib documentation): Wellington, New Zealand (41.32°S, 174.81°E) to Salamanca, Spain (40.96°N, 5.50°W) is 19,959,679.267 m with an initial bearing of 161.067669986° and a final bearing of 18.825195123°. The haversine formula gives 19,967.404 km, 7.7 km longer.

Limits

Distances are along the WGS84 ellipsoid at sea level; they ignore terrain, height above the ellipsoid and the route actually travelled. Bearings are true, not magnetic: subtract the local magnetic declination for a compass bearing.

References

Related tools

Share this page

Remind me to visit Contifield

Adds a repeating reminder to your calendar, titled “Contifield Reminder: Visit www.contifield.com”.