Calculating the Distance Between Two Points on Earth

Bilal Himite
The Startup
4 min readMay 28, 2020

--

As most of us know, Earth is not flat. It is a geoid or approximately an oblate spheroid. So, calculating the distance between two points on Earth directly on a map is not the distance you will travel in real life. Because you may have to dig through the earth to get to your destination.

In fact, no map projection preserves the distance between points on the map and does not distort it. So, a distance error will always be there. But for small distances, the error is so low that it is not worth it to go the extra mile (get it?) and calculate the exact distance.

We don’t want to calculate the Euclidean distance between the two points, but rather, the shortest distance across the surface.

We are going to derive the formula for the distance between two points on Earth given their geographical coordinates.

Geographic coordinate system

In the geographic coordinate system, the position of a point is determined by two variables:

  • Latitude φ: (-90°<φ≤90°). the angle between the equatorial plane and the line passing through the center of the earth and…

--

--

Bilal Himite
The Startup

[Looking for a 6-month internship in Data Science.] I write random tech-related content weekly. https://bilalhimite.me/