distances.online

Blog article

Why do planes seem to fly in a curve?

The shortest path between two places on Earth is not a straight line on the map.

Published: Updated: All articles

The shadow of a toy plane cast over a paper map of Europe and Asia dotted with pins.

On a map, the route of a long flight almost never appears as a straight line but as an arc. It looks like a detour, but it is the shortest way.

A globe and a piece of string are enough to check it. Fix one end on London and the other on New York and pull the string tight: it does not follow the parallel westwards; it rises over the Atlantic, passes close to Greenland and comes back down. It is the same path planes take. That path is called a great circle, and it is the edge you get when you cut the globe in two through its centre. On the sphere it is the straightest possible line.

The same route on a globe (left) and on the flat map (right). On the sphere it is the straightest line there is; on the map it bows north, and the grey line is what a ruler would draw. Click an image to enlarge it.

The trouble starts when the sphere is flattened onto a plane, as in most maps: proportions get distorted. Near the equator the flat map is almost identical to the sphere, but the further you move towards the poles, the more it stretches. On the most common map, Greenland appears almost the size of Africa, which is really about fourteen times larger.

That is why a flight path drawn on the plane looks more curved the further from the equator it runs. London–New York draws a marked arc, while Madrid–Buenos Aires, which crosses the equator, looks almost straight.

The haversine formula computes how long that path is from the coordinates of the two points.

Try it: drag the markers

The two markers below start at London and New York. Drag either one anywhere in the world and the distance updates. The blue line between them is the great-circle arc, the string pulled tight; the faint grey line is what a ruler on the flat map would draw. Move the pair further north and the blue line bows more; bring it down to the equator and the two lines almost merge.

Drag marker A or B anywhere on the map. The blue line is the shortest path over the globe, the grey one the straight line on the flat map; the distance updates as you move them.

Point A
Point B
Distance
5,576.5 km
5,576,462 m

You can also type the coordinates here.

Open London to New York in the calculator

What the haversine formula does, in words

The haversine formula is how a computer measures the string without a globe. It takes the two coordinates of each place, latitude (how far north or south of the equator) and longitude (how far east or west of the Greenwich meridian), and does two things:

  1. It works out how big a slice of the globe separates the two points: the angle between them as seen from the centre of the Earth. Madrid and Barcelona are about four and a half degrees apart out of the 360 of a full turn.
  2. It turns that slice into kilometres using the size of the Earth. A full turn around the planet is about 40,000 km, so four and a half degrees is about 500 km.

The clever part is in step 1. A degree of longitude is a long way at the equator, about 111 km, and shrinks to nothing at the poles, where all the meridians meet. The formula knows this and corrects for it, which is why it works just as well between two Norwegian towns as between two Brazilian ones.

The odd name comes from an old trigonometric function, the haversine, that sailors had in printed tables in the 1800s because it made exactly this calculation easy to do by hand on a ship. The computer version is the same idea written in a dozen lines of code.

Calculate it yourself

If you want to see what the formula actually looks like, follow the New York–London calculation number by number, copy a working JavaScript version, and learn how accurate it is on a planet that is not a perfect sphere, open the haversine calculator. It has the same interactive map, with every intermediate value of the formula recomputed as you drag.

To get the straight-line distance between any two places, together with the road distance and an estimated flight time, open the calculator and type two cities, or start from Madrid to Barcelona.