Closest point on a route
The point on a multi-leg route closest to a position: which leg, how far along the route, and how far off it (right of course positive).
Planning and education aid. Not for primary navigation. Full disclaimer
The closest point is on leg 2, 140.918 km along the route and 8.477 km off it.
- Along the route
- Off the route
- Closest point latitude
- Closest point longitude
- Route length
Provenance
- Computed by
- navigation.route.closest-point 1.0.1, core 0.1.0
- Model
- Closest point on each geodesic leg by Karney's interception method, on WGS 84
- Accuracy
- Within 1 mm, like the cross-track tool
- Notes
- None
- Cites
- Karney, C. F. F., Journal of Geodesy, Algorithms for geodesics
Something look off?
How we got thisFormula, worked example, sources, and proof
Model: Closest point on each geodesic leg by Karney's interception method, on WGS 84
Accuracy: Within 1 mm, like the cross-track tool
When to use this: Use this when the course is a whole route rather than one leg: to say which leg a position belongs to, how far along the route its closest point lies, and how far off the route it is. It is the tool for placing a reported position, a diversion, or a point of interest against a filed plan, and for measuring how far a flown track wandered from it.
Limitations: It measures to the route line itself, not to a corridor or an airway's protected width, and the cross-track sign is right of course on the leg it chose, so the sign flips at a turn. Where two legs are nearly equidistant, as inside a sharp turn, the leg reported is the nearer by geometry and may not be the one being flown. A closest point that falls past the end of a leg is reported as that waypoint, which is correct as a distance but means the answer is a corner rather than a perpendicular. A leg a quarter of the Earth or more away is skipped, keeping its length in the total but never holding the answer. Heights play no part, and the route is geodesic legs, not rhumb lines.
Worked example: A position beside the second leg of a five-leg route. Source: GeographicLib 2.7 GeodSolve: the closest point sits where the course to the position is 90.00000000000 from the leg, 8476.774536 m away, with the first leg and the run up to it summing to the along-route distance. It is golden test vector v023, and every build checks the tool still gives its answer within its tolerance.
You enter
- Position latitude
- 40.5 deg
- Position longitude
- -103.9 deg
- Route
- 40, -105 40, -104 41, -104 41, -103 40, -103 40, -102
You get
- Leg
- 2
- Along the route
- 140.918 km
- Off the route
- 8.477 km
- Closest point latitude
- 40.5000433°
- Closest point longitude
- -104°
- Route length
- 477.01 km
Review: Not yet independently reviewed by a geodesist.
Last verified: 2026-09-18, when a maintainer last confirmed this tool's sources at the issuer. See the sources ledger.
Status: version 1.0.1, core 0.1.0. See this tool in the verification report.
Changes
- 2026-09-23, fixed: Short distances lost their meaning: a 0.859 m geodesic showed as 0.001 km. Distances in the navigation tools (version 1.0.1) still show to the meter in kilometers, but a short one now keeps three significant digits, down to the millimeter, so it shows as 0.000859 km. Differences such as the rhumb line's extra distance keep fixed decimals. Values are unchanged. Changelog
Checked against: 23 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.
Sources
- Algorithms for geodesics, Karney, C. F. F., Journal of Geodesy, Vol. 87, No. 1. pp. 43-55.