1

I have 2 coordinates (Longitude and Latitude) and a distance from them to a third coordinate. How is it possible to calculate the longitude and latitude (probably 2 possibilities) of the third coordinate?

I have found these 2 answers: Calculating intersection of two Circles? How do I find the intersections of 2 circles on earths surface?

But did not understand them as I have finished my geometric lessons long ago :) I would be glad if someone could simplify it for me so I can find the third coordinate in an easy way.

Thanks!

toothpick
  • 11
  • 1

1 Answers1

2

The first example you cite has an answer that is probably the most direct, but it involves both dot products and cross products from vector algebra. Does the environment you're implementing this in have the capability to call on projection libraries to project the points into plane coordinates? If so, if you do that it becomes the simpler case of intersecting two planar circles. If not, dot products and cross products for 2 3-d vectors are not too much of a pain to implement, you can just look that up.

Jersey Andy
  • 733
  • 4
  • 7
  • Hi, thank you for your answer. I am trying to implement this on Python, and luckily I have the library numpy to use the dot products and cross products. Unfortunately, this is not the difficulty I have encountered, the first example does not show how to get x0 (which I guess is the third possible coordinate), and therefore it is impossible to get "t". I have implemented a part of the algorithm here, and when checking my result, it wasn't close to the one presented in the post. I'd be glad if someone could correct me where I have been wrong: http://pastebin.com/jZvrcTUM

    Thanks!

    – toothpick Jun 20 '14 at 19:58
  • First correction: converting to radians, the cited circle solution used some shorthand. Dividing nautmiles by 60 gives you degrees, not radians. Radians is pi/180 times degrees. So instead of distA/60 you want distApi/(60180), which is distA*2.908882e-4. – Jersey Andy Jun 20 '14 at 20:27
  • "x0 + tn" and "x0 - tn" in that example refer to the vector representations of the point you are solving for. In step 4 he defines x0 as a unique point on the intersection of the two planes, "x0 = ax1 + bx2". Try that. In other words, in your variable naming, x0 is a point with coordinates (axA + bxB, ayA + byB, azA + bzB). – Jersey Andy Jun 20 '14 at 20:46
  • And referring to my first comment above, you should probably calculate out pi/(60*180) to more precision. – Jersey Andy Jun 20 '14 at 20:47
  • Thanks! I think I have completed the algorithm: http://pastebin.com/kTyRa9bE But calculating "t" gives me difficulties because the number in the square root is negative, I think it is because my "a" and "b" result is different as the example above (for me a is 0.987769745626 and b is 0.987364416078). perhaps there is something wrong with how he presented the calculation formula? – toothpick Jun 20 '14 at 21:35
  • Certainly there could be errors in my presentation. Anticipating this possibility, I took some care to report many intermediate results to high precision. Please compute those results yourself and check them against mine. That will pin down where the problem first occurs and we can decide whether I have reported the calculation incorrectly or you have a bug. (I am confident there is no problem with the approach, because the final graphic shows that the way I actually performed the calculation does work. But it's easy to make typos when transcribing code into text.) – whuber Jun 20 '14 at 21:54
  • OK, I am getting somewhere, I did figure out calculating a and b was wrong, but still when getting to the final answer I get a really small result (less than 1.0 in longitude and latitude), can somebody help please? http://pastebin.com/rFj8E1De – toothpick Jun 21 '14 at 01:01
  • One degree of latitude is 60 nautical miles, or about 72 statute miles. Do you have some test values where you know what answer you should be getting? – Jersey Andy Jun 24 '14 at 19:56