Latitude / longitude distance and bearing.
- From: "Dave (from the UK)" <see-my-signature@xxxxxxxxxxxxx>
- Date: Sat, 01 Sep 2007 12:16:00 +0100
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
.
- Follow-Ups:
- Re: Latitude / longitude distance and bearing.
- From: KBH
- Re: Latitude / longitude distance and bearing.
- From: Don Del Grande
- Re: Latitude / longitude distance and bearing.
- From: David L. Wilson
- Re: Latitude / longitude distance and bearing.
- From: David Bernier
- Re: Latitude / longitude distance and bearing.
- Prev by Date: Re: Mathematics: art or science?
- Next by Date: Re: What's with the solution manuals?
- Previous by thread: 11.- R^+ prime coding functions.
- Next by thread: Re: Latitude / longitude distance and bearing.
- Index(es):
Relevant Pages
|