ForHosting KIT · Travel & geography

Cross-track distance calculator

A fix at 53.2611, −0.7972 sits 307.5495704195 m to the right of the great-circle track between two waypoints. Enter the point and both ends of the route to get the signed offset in metres and kilometres, labelled left, right or on track. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Latitude
53.2611
Longitude
-0.7972
Start lat
53.3206
Start lon
-1.7297
End lat
53.1887
End lon
0.1334
You get
Radius m
6,371,000
Cross track m
-307.5495704195
Cross track km
-0.3075495704
Absolute m
307.5495704195

Cross-track distance answers a precise navigation question: how far is this fix from the great-circle route I planned between two waypoints, and on which side of the track does it lie. Pilots, maritime officers, drone operators, and logistics engineers use that signed offset to monitor course deviation, build corridor alerts, and grade flight paths against a published track line without replaying a full flight-management system. This capability takes a query latitude and longitude plus path start and end coordinates on the WGS84 sphere, applies the classic spherical formula with haversine range and initial bearings, and returns metres and kilometres with a clear left, right, or on-track label. Out-of-range latitudes or longitudes fail with invalid input and are not charged.

What the cross-track distance tells you

Draw the great circle through the start of a planned route, A, and its end, B. From any third point you can drop a perpendicular onto that circle, meeting it at a right angle on the sphere. The length of that perpendicular is the cross-track distance: how far the fix sits from the planned track. The sign says on which side: positive means left when travelling from A towards B, negative means right, and values very close to zero are labelled on track. The calculator scales the angle by a sphere radius of 6,371,000 metres unless you choose another, and reports the result in metres and kilometres.

Where it is used and what to watch

Pilots, ship officers, drone operators and logistics teams use the signed offset to watch for course deviation, to raise an alert when a live position leaves its corridor, or to grade a logged flight against the published track. In the example, the query point lies 307.5495704195 metres to the right of the line from A to B. Keep the order of the two waypoints in mind, because swapping A and B flips left and right. Coordinates outside the valid ranges are refused rather than clamped, so noisy GPS data never turns into a fake offset.

Flight and maritime corridor monitoring

Compare live GPS fixes against a published great-circle track between two waypoints and alert when the signed cross-track offset exceeds the allowed corridor half-width.

Drone and robotics path grading

Score logged trajectories against a planned route line, reporting left versus right deviations in metres for QA reports and auto-graded flight tests.

What does a positive or negative cross-track value mean?

Positive means the query point lies to the left of the directed great-circle path from start to end; negative means to the right.

What happens if a latitude or longitude is out of range?

Latitude must be between −90 and 90; longitude between −180 and 180. Validation failures are not charged.

Is the cross-track distance calculator free?

The browser tool runs free on your device.

Can I change the Earth radius?

Pass another positive radius when modelling a different sphere; distances scale linearly with R.

How can I use it to raise a corridor alert?

Compare the absolute offset with the half-width of your allowed corridor. When a live position's cross-track distance exceeds it, the vehicle has left the corridor, and the sign tells you whether it drifted left or right of the track.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/geo/cross-track-distance

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/geo/cross-track-distance \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lat":53.2611,"lon":-0.7972,"start_lat":53.3206,"start_lon":-1.7297,"end_lat":53.1887,"end_lon":0.1334}'
{
  "lat": 53.2611,
  "lon": -0.7972,
  "start_lat": 53.3206,
  "start_lon": -1.7297,
  "end_lat": 53.1887,
  "end_lon": 0.1334
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "geo.cross_track_distance",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

What cross-track distance means and how to supply the three points

Imagine a great circle drawn through path start A and path end B on a spherical Earth model. From any third query point P you can drop a perpendicular along another great circle that meets the track at a right angle in the spherical sense. The length of that perpendicular, scaled by the sphere radius, is the cross-track distance. The signed form tells you which side of the directed path you are on: positive values mean left when travelling from A toward B, negative values mean right, and magnitudes near zero are reported as on track for numerical stability. Latitude must lie between minus ninety and ninety inclusive; longitude must lie between minus one hundred eighty and one hundred eighty inclusive. Send required fields lat and lon for the query point, start_lat and start_lon for A, and end_lat and end_lon for B, all in decimal degrees. Aliases such as latitude, longitude, lat1, lon1, lat2, and lon2 are accepted when your client already uses those names. Any coordinate outside those ranges raises invalid_input with a message that names the field and the bound, so callers never silently clamp bad GPS noise into a fake offset. Optional radius_m defaults to six million three hundred seventy-one thousand metres, the mean Earth radius used in many aviation examples; raise or lower it only when you intentionally model another sphere. If A and B coincide the path is undefined and the engine rejects the request. Identical inputs always produce identical JSON because the path is pure arithmetic with no wall clock and no external map service.

Reading signed metres, side labels, along-track distance, and bearings

Prefer metres for drone corridors and runway-scale monitoring; prefer kilometres for oceanic or long-haul air routes. On success the response echoes every coordinate and the radius used, then reports cross_track_m and cross_track_km as the signed perpendicular offset. absolute_m and absolute_km are the magnitude without sign, handy for threshold checks that only care how far you strayed. Validation failures never invent a distance: missing fields, non-finite numbers, out-of-range coordinates, and coincident endpoints all fail closed with invalid_input and are not charged under the prepaid API.

API usage, pricing, navigation workflows, and practical limits

The model is spherical, not ellipsoidal, so for sub-metre survey work you should apply a local ENU or full geodesic library instead; for navigation corridors, homework, and fleet alerts the mean-Earth sphere matches the formulas published in standard pilot and sailor references. Send a JSON body with the six required coordinates and optional radius_m, then call the free in-browser cross-track distance calculator for classroom demos, chart work, and quick mental checks without installing a geospatial library. Use the prepaid API when a flight-ops dashboard, vessel traffic system, last-mile delivery router, or simulation harness needs a stable contract under KIT balance at $0.002 per successful item; validation failures never consume balance after the engine rejects the request. Pair this endpoint with your own geocoder or AIS feed when you need place names or live tracks: this product only measures geometry on the sphere. Authors shipping SDKs can map cross_track_m and side directly into alert rules—fire when absolute_m exceeds a corridor half-width, and colour the map green, amber, or red from the same fields students see when they solve the spherical triangle by hand.

Classroom navigation and exam oracles

Students solve spherical cross-track problems by hand; graders pin deterministic JSON from the same A, B, and P coordinates used in the worksheet.

How do I compute cross-track distance with this calculator?

Send JSON with lat and lon for the query point plus start_lat, start_lon, end_lat, and end_lon for the path. The response includes signed cross_track_m, absolute_m, and side (left, right, or on_track).

Read the full KIT documentation →