Cross Track Error⚠ unverified
Aerospace / Navigation · Compute the cross-track error relative to a great-circle path
Parameters
| Input | Symbol | Unit | Default | Description |
|---|---|---|---|---|
| lat | lat | — | 1.0 | Latitude of the current position, in degrees |
| lon | lon | — | 1.0 | Longitude of the current position, in degrees |
| lat1 | lat1 | — | 1.0 | Latitude of the path start point, in degrees |
| lon1 | lon1 | — | 1.0 | Longitude of the path start point, in degrees |
| lat2 | lat2 | — | 1.0 | Latitude of the path end point, in degrees |
| lon2 | lon2 | — | 1.0 | Longitude of the path end point, in degrees |
| Output | Symbol | Unit | Description |
|---|---|---|---|
| result | error | m | Cross-track error from the great-circle path, in metres (m) |
The science & history
Understanding the Parameters
-
What XTE measures — imagine the desired great-circle track drawn on the Earth; the cross-track error is the length of the perpendicular dropped from the aircraft to that track. Zero means dead on course; a large value means far off to one side. It is the primary lateral-guidance signal in every RNAV/GPS approach and en-route leg.
-
The sign is the steering cue — $XTE$ comes out positive on one side of the track and negative on the other (via the $\sin(\theta_{13}-\theta_{12})$ term). A flight director converts that sign directly into a "fly left" or "fly right" command; the magnitude scales the command. Losing the sign would leave the pilot knowing they are off course but not which way to correct.
-
Built from two bearings and a distance — the calculation reuses the other great-circle tools: $d_{13}$ from Great-Circle Distance (start → current), and two bearings from Initial Heading ($\theta_{13}$ start → current, $\theta_{12}$ start → destination). The angular difference $\theta_{13}-\theta_{12}$ is how far the aircraft's actual direction-from-start deviates from the intended track direction; projecting the traveled distance onto the perpendicular gives the sideways offset.
-
The along-track companion — XTE has a sibling, the along-track distance (how far along the route the aircraft has progressed), together giving a full "position relative to the leg." This calculator returns only the cross-track component, which is what lateral guidance needs.
-
Small-angle intuition — for offsets small compared with the Earth ($d_{13}\ll R$), $\sin(d_{13}/R)\approx d_{13}/R$ and $XTE \approx d_{13}\sin(\theta_{13}-\theta_{12})$ — literally "distance traveled times the sine of the heading error," the flat-Earth result. The full spherical form corrects it for long legs.
Derivation (Approaching a Proof)
Set up the spherical triangle with vertices at the path start point (call it 1), the current position (3), and the destination (2). The cross-track distance is the perpendicular from vertex 3 to the great circle through 1 and 2.
Angular distance from start to current. Convert the great-circle distance $d_{13}$ to an angle at the Earth's centre: $\delta_{13} = d_{13}/R$ (arc length over radius).
Heading deviation. The bearing from start to current position is $\theta_{13}$; the bearing from start to destination (the desired track) is $\theta_{12}$. Their difference $\Delta\theta = \theta_{13}-\theta_{12}$ is the angle, at the start vertex, between "the way we actually went" and "the way we should go."
Napier's rule for the right spherical triangle. Drop the perpendicular from the current position (3) to the desired track; call the cross-track angular distance $\delta_{xt}$. In the right spherical triangle formed by the start, the foot of the perpendicular, and the current position, the side opposite the angle $\Delta\theta$ is the cross-track arc, and the hypotenuse is $\delta_{13}$. The spherical sine rule for this right triangle gives:
$$\sin\delta_{xt} = \sin\delta_{13}\,\sin\Delta\theta.$$
Solve for the cross-track angular distance and convert back to metres by multiplying by $R$:
$$\delta_{xt} = \arcsin\!\big(\sin\delta_{13}\,\sin\Delta\theta\big) \quad\Longrightarrow\quad XTE = R\,\delta_{xt} = R\,\arcsin\!\big(\sin(d_{13}/R)\,\sin(\theta_{13}-\theta_{12})\big). \qquad\blacksquare$$
The $\sin\Delta\theta$ factor carries the sign: if the current position lies to the right of the track, $\Delta\theta$ is positive and so is $XTE$; to the left, both flip. This is the exact spherical result — no small-angle approximation — which is why it reuses the well-conditioned haversine distance and $\operatorname{atan2}$ bearings rather than re-deriving from raw coordinates.
Dimensional check. $d_{13}/R$ is dimensionless (an angle in radians); $\sin(\cdot)\sin(\cdot)$ is dimensionless, so $\arcsin$ returns radians, and $R\times$ radians gives metres ✓.
History and Development
-
From the sailing triangle to RNAV. Cross-track error is a modern digital form of the age-old navigator's question "how far am I off the intended course line?" — once solved graphically on charts, now computed continuously by GPS/FMS from the great-circle geometry.
-
Area navigation (RNAV/RNP). The whole edifice of RNAV (area navigation) and RNP (required navigation performance) rests on the aircraft knowing and bounding its cross-track error: an RNP-1 approach requires the total error to stay within 1 nautical mile of the centreline 95 % of the time. XTE is the quantity being monitored and displayed (the "deviation bar").
-
Autopilot lateral guidance. In LNAV mode the autopilot's outer loop drives XTE toward zero, feeding a commanded bank angle proportional to the cross-track error and its rate — the same control-law structure as any tracking servo, wrapped around this spherical-geometry measurement.
Related Concepts: Great-Circle Distance, Initial Heading, Time To Go, Magnetic Heading, Ground Track Velocity
Notes: Signed perpendicular distance from the intended great-circle track; the sign = which way to
steer (left/right). Built from Great-Circle Distance ($d_{13}$) + two Initial Heading bearings
($\theta_{13},\theta_{12}$) via the right-spherical-triangle sine rule $\sin\delta_{xt}=\sin\delta_{13}\sin\Delta\theta$.
Exact on the sphere; small-leg limit $XTE\approx d_{13}\sin\Delta\theta$. Lat/lon inputs labelled
dimensionless but are degrees; $R$ hard-coded $6{,}371$ km. The core signal of RNAV/RNP lateral guidance.