How GPS Trip Distance Is Estimated: Coordinates, Noise and the Haversine Formula
Learn how consecutive coordinates become a distance estimate, why GPS drift adds false movement, and what filtering can and cannot fix.
A GPS trip counter usually estimates distance by comparing successive positions. Each position is an estimate, not an exact point on the ground. Small errors can accumulate, especially when the device is nearly stationary or when reception changes. Understanding the calculation helps explain why a route trace and a car odometer may not match perfectly.
From coordinates to a segment distance
A location update commonly contains latitude and longitude in decimal degrees. To estimate the distance between two fixes, software converts the angular coordinates to radians and calculates the great-circle distance between them. The Haversine formula is a common spherical approximation. It is useful for many everyday distances, although Earth is not a perfect sphere and high-precision geodesy may use ellipsoidal methods.
The Haversine formula in plain language
For two positions, compute the latitude difference and longitude difference, combine them with trigonometric functions, then multiply the resulting central angle by an assumed Earth radius. The result is an estimate of the shortest surface distance between those points. Summing segment distances approximates a path, but only as well as the positions describe that path. If the sampling interval is long, turns between samples are not captured.
a = sin²(Δφ/2) + cos(φ₁) cos(φ₂) sin²(Δλ/2); c = 2 atan2(√a, √(1−a)); d = R × c
φ represents latitude, λ represents longitude, and R is the chosen Earth radius. This is a spherical approximation, not a guarantee of exact route distance.
Why stationary drift adds distance
A receiver may report slightly different coordinates even when a person stands still. If every small change is counted as travel, the total grows without real movement. A practical tracker may ignore tiny movements or low-confidence fixes, but filters create a trade-off: aggressive filtering reduces jitter while potentially omitting slow movement or small turns. There is no universal threshold that works perfectly for walking, cycling and driving.
Sampling interval and missed turns
Frequent reliable updates can describe a route more closely, but the browser does not guarantee a fixed update rate. Backgrounding a tab, power saving and device conditions may delay updates. If a route bends between two fixes, straight-line distance between the fixes is shorter than the road or path actually travelled. Distance estimates can therefore undercount winding routes, while noisy fixes can overcount them.
A useful way to validate a trip
Test a known route several times under similar conditions and compare results with a trusted reference, while remembering that the reference also has limitations. Record whether the trip started after a stable fix, whether the phone was carried consistently and whether there were signal gaps. Avoid interpreting a difference of a few metres as a meaningful performance change without a controlled method.
Frequently asked questions
Does the formula measure road distance?
No. It estimates the direct surface distance between two coordinates. Summing many segments approximates a route, but cannot reconstruct unobserved bends.
Why can distance increase while I stand still?
Small position changes from location uncertainty may be interpreted as movement. Filtering helps but cannot eliminate all error.
Further reading
These references provide additional technical background. They do not imply endorsement of this website.