Latitude / longitude distance and bearing.



I have two locations, call them 'a' and 'b' .

a) Altitude of a and b (call them alt_a and alt_b).
b) Latitude of b and b (call them lat_a and lat_b)
c) Longitude of a and b (call them long_a and long_b)


'a' and 'b' are fairly close together (10 - 20 km) and in line of sight distance. (Two mountain peaks).

I want to find

1) The straight line distances from a to b. (*Not* the distance along the circumference of the earth, which I can get from the Haversine formula)


2) The bearing of 'a' when viewed from 'b'.

3) The vertical angle - i.e how many degress above the horizon is 'a' when viewed from 'b'. (alt_a > alt_b).

If the distances were sufficiently large, the location with the higher altitude could be below the horizon when viewed from the one with lower altitude, but in this case, the distances are small. so the location with the higher altitude is well above the horizon of the location with the lower altitude.

I am willing to assume the earth is spherical. The distances involved are not huge (a few tens of km), and are in Europe (Latitude is North, Longitude is East).

I asked this on 'Dr. Math' and someone suggested I worked in spherical coordinates (rho, theta, phi) then transfered to rectangular.

I've done that and found the points x_a, y_a and z_a using

rho_a=EARTH_RADIUS+alt_a;
theta_a=long_a;
phi_a=M_PI/2.0-lat_a;

Transfered to cartesian coordines

x_a= rho_a*cos(theta_a)*sin(phi_a);
y_a = rho_a*sin(theta_a)*sin(phi_a);
z_a = rho_a*cos(phi_a);

so I get the points x_a, y_a and z_a relative to the point 0,0,0 which is the centre of the earth.

I did likewise for location b, to get x_b, y_b and z_b.

Then I computed

dx=x_a-x_b
dy=y_a-y_b
dz=z_a-z_b


The radial distance between a and b, which is one of the 3 parameters I need, is

r=sqrt(dx*dx + dy*dy + dz*dz);

But I'm stuck as how to find the other two parameters - the bearing the angle above the horizon.

I'm aware of this page:

http://www.movable-type.co.uk/scripts/latlong.html

which has formula for the bearing between two locations, but there is nothing there about altitude, which I suspect might mean the forumula are not valid.

Any thoughts?


--
Dave (from the UK)

Please note my email address changes periodically to avoid spam.
It is always of the form: month-year@xxxxxxxxxxxx
Hitting reply will work for a few months only - later set it manually.

http://chessdb.sourceforge.net/ - a Free open-source Chess Database
.



Relevant Pages

  • Mountain Biking GPS
    ... need it for mapping trails and distances. ... Altitude or elevation gain/lost ...
    (sci.geo.satellite-nav)
  • Re: Can the Q400 really do 480mph ???
    ... - altitude and distances were perfectly OK, never ever had any problems with speed before, in car, or on other aircraft. ... satellites and was showing no other erroneous readings, it showed a steady ... presumably there was a significant tailwind. ...
    (uk.rec.aviation)
  • Re: Pros and cons of using the A-Bomb
    ... might have been able to manage the 10,000 lb. payload over the shorter ... distances from there to the targets. ... With enough altitude and speed to get away? ...
    (soc.history.war.world-war-ii)
  • Re: How many/which wedges?
    ... I carry 4 wedges because I need them for different ... Also, carrying 4 wedges gives me more options around the green, and ... The only way you can get these distances is by de-lofting the club. ... Or play at altitude. ...
    (rec.sport.golf)
  • Re: Help with Declination Math
    ... > in my head to determine the altitude of a star in the sky at any time. ... > North-Eastern sky this evening at 04:00 UTC at my latitude of 33 degrees. ... the right angle formed by your local zenith and local horizon. ... celestial equator is 90 degrees away from Polaris. ...
    (sci.astro.amateur)