# cross track distance to great cicle line and rhumb line

How to calculate cross track distance to great cicle line and rhumb line?

For great circle line, I've tried this formula, but it is not accurate while the distance is less than 0.1nm.

For rhumb line, I've applied the cartesian vector projection method(see: dist_Point_to_Segment). Take one point as origin and calculate vectors based on rhumb distance and bearing. Then find the closest point on rhumb line, and calculte great circle distance on it. But I'm not sure whether this method is correct for the case.

• You probably need to provide more details about your problem. How did you decide the referenced formula was not accurate? Nov 7, 2014 at 5:44
• Are you talking about accuracy of spherical verses ellipsoidal computational geodesy? Nov 8, 2014 at 23:55

See this link for code (using GeographicLib) to compute the cross track distance to a geodesic. This does the ellipsoidal calculation and is accurate to 20 nanometers or so.

Also look at "Calculation 2. Distance from a point to a line" on this site. This calculates the cross track path with Javascript and displays the result.

• Great, just what I wanted. But what about the distance to rhumb line? Pls see my updated question. Nov 10, 2014 at 3:03

I assume you mean the (shortest) distance between the two spherical curves (?): the great circle path from A to B OR the rhumb line path (section of loxodrome) that passes through A and B. To derive the solution is a difficult problem in spherical geometry. Here are some comments.

Recall that the loxodrome is the curve on the sphere that intersects each meridian (line of longitude) of the sphere or Earth at the same (spherical) angle. The angle of intersection of loxodrome and meridian I call "alpha", and I think of alpha as 0 or zero for directly North, alpha = 90 degrees for East. To specify a loxodrome we need to give both a point on the curve and alpha. (There are an infinite family of loxodromes with the same alpha but for each a unique point along the equator.)

I work to develop parametric equations for the two spherical curves, i.e.,

(1) the arc between A and B (2) the loxodrome through A with given (but TBD) azimuthal angle alpha, the alpha that allows the curve to pass through B

The first curve's arc length and lat,long relations are well known, but the seconds are not. ...

The solution for the cross-track distance to a rhumb line is giving in this link which computes an accurate intercept for the WGS84 ellipsoid given a sufficiently accurate initial guess. This computes the shortest geodesic intercept. The geodesic intercept has the nice property that the angle of interception is 90°. (This isn't the case if the intercept path is the shortest rhumb line or shortest great ellipse.) The solution is via Newton's method solving for a zero of the cosine of the intercept angle. The same method can be applied to the calculation of the cross-track distance to a geodesic (and this provides an alternative solution to that given by my previous answer).

• Thank you very much for your excellent answers. They solved my problem perfectly. Nov 25, 2014 at 5:50