Re: calculating the azimuth between two lat/lon's
- To: mathgroup at smc.vnet.net
- Subject: [mg34790] Re: calculating the azimuth between two lat/lon's
- From: rainer <rainer.gruber at gmx.at>
- Date: Fri, 7 Jun 2002 01:08:52 -0400 (EDT)
- Organization: Johannes Kepler Universitaet Linz
- References: <adkg5p$a0h$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
rad0 wrote:
> Is there a built in way to calculate the azimuth between
> two points given by their latitude and longitude?
>
Hi rad0,
I don't think that there's a "built in way" in Mathematica but you easy
can calculate that angle.
If we have two vectors
v1 = r1 {Sin[theta1] Cos[phi1], Sin[theta1] Sin[phi1], Cos[theta1]}
v2 = r2 {Sin[theta2] Cos[phi2], Sin[theta2] Sin[phi2], Cos[theta2]}
(where the phi's are the longitudes and the theta's are the latitudes,
measured from the z-axis)
you can use the relation of the product of two vectors to get theta12,
the angle between the two vectors:
Solve[v1.v2 == r1 r2 Cos[theta12], Cos[theta12]]
Solving and Simplifying yields something like
Cos[theta12] ->
Sin[theta1] Sin[theta2] Cos[phi1-phi2] + Cos[theta1] Cos[theta2]
Rainer Gruber
JOHANNES KEPLER UNIVERSITY LINZ
Institute of Experimental Physics
Atomic Physics and Surface Science