0

There is plenty of information on finding the distances between two WGS 84 lat/lon points but not much on the distance between two WGS 84 /lat/lon/alt points, are there any libraries that can do this? can anyone point me to information about this? I am using it for a UAV collision avoidance system so it needs to be accurate for distances 0-20m away further than that I don'y really care.

Mark Omo
  • 898
  • 2
  • 12
  • 26

1 Answers1

2

think of it like a triangle enter image description here

now just use simple geometry to find the length of the hypotenous

a**2+b**2 = c**2
latlon_dist**2+height_dist**2 = distance**2
distance = sqrt(latlon_dist**2+height_dist**2)
Joran Beasley
  • 110,522
  • 12
  • 160
  • 179
  • I am aware of how to find the distance in x/y/z the problem is that, the earth is a spheroid, though that might work for the very short distances I am using – Mark Omo Feb 04 '16 at 23:24
  • see this answer also http://stackoverflow.com/questions/1108965/taking-altitude-into-account-when-calculating-geodesic-distance – Joran Beasley Feb 04 '16 at 23:28
  • Ran some tests with around 200m it seems to agree within 3 digits with this: http://cosinekitty.com/compass.html thanks! can't believe I didn't think of that before. – Mark Omo Feb 04 '16 at 23:35