CalcWorldHub
Free online calculator · no signup

Spherical route cross track and nearest segment calculator

Measure signed offset from a great-circle route and distance to the nearest point on its finite minor-arc segment.

4,000 tools
Spherical route cross track and nearest segment calculator — Route start latitude (degrees), Route start longitude (degrees east), Route end latitude (degrees) and calculation method
Spherical route cross track and nearest segment calculator: inputs and calculation method.

How to use this calculator

Measure signed offset from a great-circle route and distance to the nearest point on its finite minor-arc segment.

  1. Enter Route start latitude (degrees), Route start longitude (degrees east), Route end latitude (degrees), Route end longitude (degrees east), then complete the remaining labeled fields. Match the units shown beside each field and review the result together with the assumptions below.
  2. Read the worked example below to check the expected input format and result.
  3. Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Calculation guide

Spherical route cross track and nearest segment explained

Signed cross-track distance positive left138.8405km
Signed cross-track distance positive left: 138.84047381 km in the worked scenario.

How the calculation works

n=(u1×u2)/|u1×u2|; cross-track angle=asin(p·n); along-track=atan2[p·(n×u1),p·u1].

The oriented route normal defines positive left-of-travel offset. The perpendicular great-circle foot may lie outside the finite route, so compare endpoint distances when it does. This distinguishes infinite-route cross-track error from distance to an actual segment.

Set up the calculation

lat1 — Route start latitude (degrees)
Latitude of the query location, in degrees north.
lon1 — Route start longitude (degrees east)
Longitude of the query location, in degrees east.
lat2 — Route end latitude (degrees)
Latitude of the route endpoint, in degrees north.
lon2 — Route end longitude (degrees east)
Longitude of the route endpoint, in degrees east.
lat — Query latitude (degrees)
Latitude of the separate query point, not either route endpoint.
lon — Query longitude (degrees east)
East-positive longitude of the query point whose route offset is measured.
R — Reference sphere radius (km)
Spherical radius used to convert angular separation to distance, in kilometres. The default is mean Earth radius; change it only for a different sphere.

Limits of this model

Spherical minor-arc route with distinct nonantipodal endpoints. A point at the route great-circle pole has no unique perpendicular foot and is rejected. No ellipsoidal path, road network, terrain, or navigation-system correction.

Check this example

Route start latitude (degrees) = 49; Route start longitude (degrees east) = 20; Route end latitude (degrees) = 52; Route end longitude (degrees east) = 35; Query latitude (degrees) = 52; Query longitude (degrees east) = 27; Reference sphere radius (km) = 6371.0088.

  • Signed cross-track distance positive left: 138.84047381 km
  • Along-track distance to great-circle foot: 580.25541381 km
  • Nearest finite-route distance: 138.84047381 km
  • Nearest segment latitude longitude: 50.80965515, 27.60441865 degrees

The query sits north of part of the eastward route. A positive left-offset convention should be interpreted relative to travel from the entered start toward the end.

Reading the outputs

Along-track distance can be negative or beyond the segment length. The nearest finite-route result always uses a point actually on the segment.

Frequently asked questions

Which side is positive?

Left when traveling from the first endpoint toward the second.

Is cross-track distance always the segment distance?

No. Outside the endpoint span, a segment endpoint can be closest.

What if I reverse the route?

The cross-track sign reverses and the along-track origin changes.

How do I use the Spherical route cross track and nearest segment calculator?

Enter Route start latitude (degrees), Route start longitude (degrees east), Route end latitude (degrees), Route end longitude (degrees east), then complete the remaining labeled fields. Match the units shown beside each field and review the result together with the assumptions below.

What is a worked example of Spherical route cross track and nearest segment?

Route start latitude (degrees) = 49; Route start longitude (degrees east) = 20; Route end latitude (degrees) = 52; Route end longitude (degrees east) = 35; Query latitude (degrees) = 52; Query longitude (degrees east) = 27; Reference sphere radius (km) = 6371.0088. Signed cross-track distance positive left: 138.84047381 km Along-track distance to great-circle foot: 580.25541381 km Nearest finite-route distance: 138.84047381 km Nearest segment latitude longitude: 50.80965515, 27.60441865 degrees The query sits north of part of the eastward route. A positive left-offset convention should be interpreted relative to travel from the entered start toward the end.