Monday, January 23rd, 2017 4:22 GMT

We have a lot of instances on our site where we take two coordinates and provide the distance and direction between the two. We use two mathematical formulas in order to provide these two calculations. For the distance between two points, we use the Haversine formula which calculates the great circle distance. For the constant bearing from one point to another, we calculate the bearing of a rhumb line between the two points in order to present the cardinal direction.

Using two different methods automatically makes our calculations a bit more "off" in some ways than what you might expect, though I do not know of a better way. The great circle calculation gives you the shortest distance between two points on a sphere. With the Earth not being a perfect sphere, this also means that a small error will exist depending on where the coordinates are on the Earth. When we want the shortest distance between two points on the planet Earth, the best method to use to get the distance is a great circle calculation. If you have an actual round globe at home, this can best be illustrated by taking a string and connecting two points. You may notice something that makes things more complex when you want to try to calculate the bearing. That string may cross a line of the same latitude twice on your way from one coordinate to the next. If you were to look at a Mercator projection of Earth, the straight line you saw on the round globe would be curved rather than straight. Using this type of map, you may think that drawing a straight line on it would give you the closest distance between the two points rather than a curve. However, this is the false impression you get from looking at a map like this.

Now that we have the closest distance between two points, we need to calculate the direction between the two points. We want to calculate the true bearing which relates to true North, not magnetic North. For ordinary purposes, we think of North as being located at the North Pole. For the bearing calculation, we present true north as being at 0°, meaning that on any point on the globe, true north will take you to the North Pole.

As we discussed above, the shortest distance between two points on Earth often involves what would appear as a curve on a Mercator projection of the Earth. A great circle distance is made up of different bearings along the route that are constantly changing. For this reason, we want to go back to the Mercator projection of the Earth. When you draw a line between two points on that map you will almost never get the shortest distance between two points, but you will get a line between two points that has a constant bearing. And from that bearing, you now get the cardinal direction, the easy to understand wording like North, South, East or West. You can learn about the cardinal direction calculation we use by visiting the page here.

What this means is that if you were to travel in the direction indicated by the constant bearing, it would usually be a longer trip than noted by the distance we give. Since we wanted to give a nice direction and also give you the best estimation of distance, we had to perform two separate calculations.

You can find out some information about the city coordinates we use on this site by clicking here.

Below you can find some of the sites used to create our distance products along with other helpful sites...

Great Circle Calculator:

http://williams.best.vwh.net/gccalc.htm

Calculate distance, bearing and more between two Latitude/Longitude points:

http://www.movable-type.co.uk/scripts/latlong.html

Geographic calculators:

http://www.gpsvisualizer.com/calculators/

Great circle distance:

http://en.wikipedia.org/wiki/Great-circle_distance

Rhumb line:

http://en.wikipedia.org/wiki/Rhumb_line

The Math Forum at Drexel University: Deriving the Haversine Formula:

http://mathforum.org/library/drmath/view/51879.html

The Math Forum at Drexel University: Rhumb Lines:

http://mathforum.org/library/drmath/view/53548.html

The Math Forum at Drexel University: Rhumb Lines and Great Circle Routes:

http://mathforum.org/library/drmath/view/52318.html

Haversine formula:

http://en.wikipedia.org/wiki/Haversine_formula

Cardinal direction:

http://en.wikipedia.org/wiki/Cardinal_direction