Advertisement

Latitude longitude distance calculator

Enter the coordinates of two places to get the shortest surface distance between them and the compass bearings at each end. Coordinates can be typed as decimal degrees or as degrees, minutes and seconds with a hemisphere letter.

Calculator

Great-circle distance
5,648.61
Initial bearing
56.16
Final bearing
117.61

Advertisement

How this calculator works

A great circle is the largest circle that can be drawn on a sphere, and the shortest surface path between two points is an arc of one. Latitude and longitude are spherical coordinates, so the distance is not the straight line on a flat map and not the simple difference in degrees. The haversine form is stable for the small distances that arise between nearby towns, where a direct spherical law of cosines can lose precision. Bearings are measured clockwise from true north and change along the route, so the initial and final bearings are reported separately.

Formula

Let phi be latitude and lambda longitude in radians, and R = 6,371.0088 km. dphi = phi2 - phi1, dlambda = lambda2 - lambda1. a = sin^2(dphi/2) + cos(phi1) cos(phi2) sin^2(dlambda/2); distance = 2R asin(sqrt(a)). Initial bearing = atan2(sin(dlambda) cos(phi2), cos(phi1) sin(phi2) - sin(phi1) cos(phi2) cos(dlambda)). Final bearing = initial bearing from point 2 back to point 1, plus 180 degrees.

Worked example

Ottawa at 45 25 21 N, 75 41 51 W to Paris at 48 51 24 N, 2 21 3 E. In decimal degrees that is 45.4225, -75.6975 and 48.8567, 2.3508. The haversine distance is about 5,649 km. The initial bearing is roughly 56.2 degrees, north-east, and the final bearing roughly 117.6 degrees, east-south-east.

Advertisement

Frequently asked questions

How do I enter a southern or western coordinate?

Use S or W, or a minus sign in decimal degrees. 75 41 51 W and -75.6975 are the same longitude. Decimal degrees and DMS mode give identical results when the values agree.

Why is this different from a road distance?

The result is the shortest path over a smooth sphere, with no roads, coastlines or terrain. A road or rail route is almost always longer. The calculator also ignores the slight flattening of the Earth, which changes distances by a few tenths of a percent.

Which Earth radius is used?

The IUGG mean radius of 6,371.0088 km. Results using a spherical model are usually within about 0.3 percent of an ellipsoidal calculation, which is fine for travel planning and map work.

What is the difference between the initial and final bearing?

On a great circle the direction of travel slowly rotates relative to the meridians. The initial bearing is the direction to set out on; the final bearing is the direction of arrival. On a short route the two are close; on a long intercontinental route they can differ by tens of degrees.

Sources

Advertisement