1

Knowing lat/long of point A , B and C. And knowing cross track distance (CTX) from point B to point D. How to find lat/long of point D?ctx

Vince
  • 20,017
  • 15
  • 45
  • 64
mwweb
  • 111
  • 2
  • https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line – FelixIP Mar 03 '19 at 18:42
  • This is, of course, moderately to greatly complicated by base units of degrees. It seems unlikely that ADC overlaps AC in most geodetic calculations. – Vince Mar 03 '19 at 18:44
  • If A-D is the shortest path between A and B, this problem can easily have zero or two solutions. How are you sure that the solution is unique? Also, the mathematic develop can be hard for a sphere, I don't know if can be possible for a ellipsoid. Have you tried something to find the solution? – Gabriel De Luca Mar 03 '19 at 21:00
  • @GabrielDeLuca Yes, knowing the bearing between A and C and using pythagorean theorem to find the distance from A to D i can perform direct geodesic to find the exact lat /long of point D. i was wondering if there is another method to find the coordinates of point D ? – mwweb Mar 03 '19 at 21:26
  • @FelixIP en.wikipedia.org/wiki/Distance_from_a_point_to_a_line this finds the distance from point to a line not the cordinates of the point in the line. – mwweb Mar 03 '19 at 22:53
  • Leaving aside that the Pythagorean theorem is not true on curved surfaces, if they were all flat coordinates the solution found by the Pythagorean method would be finding a false solution too, because (unless they are chosen on purpose) it is most likely that given the coordinates of A, B and C, and the B-D distance, the angle in D is not straight. Even the solution would be much simpler (also even for spherical trigonometry) if you said that the angle in D is straight and you did not give the distance between B and D. – Gabriel De Luca Mar 03 '19 at 23:19
  • @GabrielDeLuca the distance from B to D is found using https://www.navlab.net/nvector/ check example 10 and it looks like the angle in D is straight ( 90 degree ). I dont see how the Pythagorean method assuming flat coordinates would find a false solution? – mwweb Mar 03 '19 at 23:37
  • Dig dip, check "another formula" on that page. – FelixIP Mar 03 '19 at 23:37
  • @GabrielDeLuca what solution you suggest if B is a moving body and the distance from A to C is about 100 miles and the distance from B to D not more than 200 meters. – mwweb Mar 03 '19 at 23:47
  • I added an answer for the calculation of the coordinates of point D, considering the condition that the angle in D is straight, making use of spherical trigonometry. – Gabriel De Luca Mar 04 '19 at 03:00

1 Answers1

3

Given the coordinates of A, B and C, and knowing that the angle in D is straight, we do not need to know the distance between B and D. We could calculate it, but in truth it is not necessary to know the coordinates of D.

Consider the straight spherical triangle formed by the vertices A, B, and D, with right angle in D. Let alpha be the angle in A. Knowing the distance between A and B (let's call it d), the distance between A and D (let's call it b) can be calculated as:

b = ATAN( TAN( d) * COS( alpha))

Source: https://en.wikipedia.org/wiki/Solution_of_triangles#Solving_right-angled_spherical_triangles

This formula is developed on the unit sphere. We will do all the calculations on it.

Note: Since d, alpha and b, will always be included in the first quadrant for your use case (they will be in the interval between 0 and PI/2, or 2*k*PI multiples of that interval), the results should always be positive and they would not have ambiguities.


The distance d can be calculated by developing the haversine formula:

d = 2 * ASIN( SQRT( SIN(( phi_b - phi_a) / 2)^2 + COS( phi_a) * COS( phi_b) * SIN(( lambda_b - lambda_a) / 2)^2))  

Where phi_a, phi_b, lambda_a and lambda_b are the latitudes and longitudes of points A and B respectively, all in radians.


alpha is the absolute difference between the initial azimuth from A to B and the initial azimuth from A to C:

alpha = ABS( azimuth_ab - azimuth_ac)

And both azimuths can be calculated by developing the spherical law of sines and the spherical law of cosines for a spherical triangle with a vertex at the North pole (allow me in this opportunity to omit the full development):

azimuth_ab = ATAN2( SIN( lamda_b - lambda_a) * COS( phi_b), COS( phi_a) * SIN( phi_b) - SIN( phi_a) * COS( phi_b) * COS( lambda_b - lambda_a))  
azimuth_ac = ATAN2( SIN( lamda_c - lambda_a) * COS( phi_c), COS( phi_a) * SIN( phi_c) - SIN( phi_a) * COS( phi_c) * COS( lambda_c - lambda_a)) 

Note: Sines and cosines can be positive or negative depending of the global position of the points, so we use the ATAN2() function instead of the ATAN() for a division.


Finally, knowing b and azimuth_ac, we can find the coordinates of D. The development of these formulas was already exposed in the following answer: Get lat/long given current point, distance and bearing

phi_d = ASIN( SIN( phi_a) * COS( b) + COS( phi_a) * SIN( b) * COS( azimuth_ac))  
lambda_d = lambda_a + ATAN( SIN( azimuth_ac) * SIN( b) * COS( phi_a) / (COS( b) - SIN( phi_a) * SIN( phi_d))) 

Other notes and some reference links:

  • The distance d is the length of the side opposite the angle at D in the spherical triangle, in the same way that the distance b is the length of the side opposite the angle at B. Both lengths correspond to the angle of the arc segment, in radians, on the unit sphere. At no time is it necessary to use a certain radius for the sphere, but if you wish to know lengths on a sphere of radius R other than 1, you must multiply the distances calculated by that radius.

  • I know that there are libraries for solving the inverse problem that allow us to calculate the distance between two points of known coordinates on the ellipsoid more precisely than the formula of the haversine (although probably it would not make sense to use them to reduce then that distance to the unit sphere), through iterative methods or reductions of series to their first terms. I'm not really familiar with them but if links are proposed in the comments I can add them to my answer.

  • Many of these formulas can be found on the Ed Williams' Aviation Formulary

  • Chriss Veness developed JavaScript libraries for some of these formulas, which are published in his geodesy repository at GitHub, and expressed in his site: http://www.movable-type.co.uk/scripts/latlong.html.

  • Whuber and cffk have written great answers about the error produced by calculations on the sphere instead of on the ellipsoid: How accurate is approximating the Earth as a sphere?.

  • Sines of very small angles are very small too (and cosines are very close to 1). Use as many decimal places as you can.

  • Please verify the results with known coordinate data before making productive use of these formulas.

Gabriel De Luca
  • 14,289
  • 3
  • 20
  • 51
  • The only comment I have is that distances (both b and d) as presented here are in radians (because you need them in radians to calculate the projection lat and long coordinates), and if you need at some point the actual distance in meters you'll need to multiply these with the Earth radius (6371000) – Monomachus Feb 13 '21 at 22:14