geoprimsField-grade geospatial math

Cross-track and along-track distance

How far a point is off the course line from A to B (right of course positive), how far along the course its closest point lies, and that point, on the ellipsoid to the millimeter.

Planning and education aid. Not for primary navigation. Full disclaimer

324.595126km

The point is 324.595126 km off course, 1,149.281189 km along it.

Along-track distance
Closest point latitude
Closest point longitude
Within the segment
Segment length
Provenance
Computed by
navigation.route.cross-track 1.0.1, core 0.1.0
Model
Closest point on the geodesic by Karney's interception method on WGS 84
Accuracy
Foot point within 1 mm of a brute-force search along the geodesic; the spherical method is the classic formula on the mean radius
Notes
None
Cites
Karney, C. F. F., Journal of Geodesy, Algorithms for geodesics

Something look off?

Your values

Showing an example. Change anything.
More options 3
Run many at once from a CSV

Loading…

How we got thisFormula, worked example, sources, and proof

Model: Closest point on the geodesic by Karney's interception method on WGS 84

Accuracy: Foot point within 1 mm of a brute-force search along the geodesic; the spherical method is the classic formula on the mean radius

When to use this: Use this when you want to know how far off a course line you are, and where along the line your closest point lies: checking a track against a planned leg, measuring a deviation, or finding where to rejoin. Right of course is positive, so the sign tells you which way to correct.

Limitations: It measures distance from the course line on the ellipsoid, not from a corridor's edge or an airway's protected width, and it does not know whether the closest point lies between the ends of the leg or beyond them, so check the along-track distance before acting on it. Heights play no part, and the answer is geometry rather than guidance.

Worked example: Off course on the JFK to London Heathrow line. Source: navigation route-geometry scenario: a point south-east of the JFK-LHR geodesic near the start is right of course. It is golden test vector v001, and every build checks the tool still gives its answer within its tolerance.

You enter

Point latitude
44 deg
Start latitude
40.6413 deg
End latitude
51.47 deg
Point longitude
-60 deg
Start longitude
-73.7781 deg
End longitude
-0.4543 deg

You get

Cross-track distance
324.595126 km
Along-track distance
1,149.281189 km
Closest point latitude
46.5353189°
Closest point longitude
-62.05414°
Within the segment
yes
Segment length
5,554.909 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

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