Calculating the distance between two points on a flat piece of paper is simple geometry. However, when you are building a global telemetry tool, you must account for the fact that the Earth is a sphere. This is where the Haversine formula becomes essential.
If a GPS receiver simply drew a straight line between two GPS coordinates (Latitude A, Longitude A to Latitude B, Longitude B), it would be calculating a line that cuts through the ground. To measure the actual distance a human travels over the surface of the Earth, we must calculate the "great-circle distance".
The Haversine formula determines the great-circle distance between two points on a sphere given their longitudes and latitudes. In our web application, the JavaScript engine computes this formula every single second as you move.
By constantly polling the W3C Geolocation API and running the data through the Haversine formula, our system can continuously calculate the exact distance you have moved over a 1-second interval. Speed is simply distance divided by time. Therefore, accurately calculating the great-circle distance is the fundamental bedrock of providing a highly accurate, real-time digital speedometer inside a standard web browser.