# Computing Azimuth and Elevation using GPS coordinates

Discussion in 'General GPS Discussion' started by steve, Sep 23, 2003.

1. ### steveGuest

I have been looking into how to compute Azimuth and Elevation from a
fixed set of coordinates (ground level) to a moving set of coordinates
(an aircraft) assuming both sets of GPS coordinates are known (Lat /
Long / El). The idea is to allow a motorized highly directional antenna
to be pointed (open loop tracking) at an aircraft which is above the
horizon with respect to the ground station. The aircraft will be
broadcasting its GPS coordinates to the ground station.

I am sure that someone has derived the solution for this problem, so I
thought I would toss out a query to the group.

Does anyone have some helpful suggestions where I might find links or
references regarding this problem? I've been googling all day I have been looking at converting both sets of coords into cartesian and
then computing Az / El, but sadly I am struggling with how to get Az and
El from the cartesian coords -- perhaps if I sleep on the problem....

Regards,

Steve

steve, Sep 23, 2003

2. ### KBHGuest

I have been looking into how to compute Azimuth and Elevation from a
Well, convert to UTM.and say that the North coordinate of Point A is An, the
East coordinate of Point A is Ae, the North coordinate of Point B is Bn, and
the East coordinate of Point B is Be. The direction of A to B is
InvTan((Be - Ae) / (Bn - An)) . If (Be - Ae) is positive that is East
direction while if (Be - Ae) is negative that is West direction. Next if
(Bn - An) is positive that is North direction while if (Bn - An) is negative
that is South direction. So the result is a four-quadrant direction. For
example S20E as a four-quadrant direction would be 160 degrees as a
clockwise azimuth from North...

Next calculate the distance Ds from A to B as the square root of ((Be -
Ae)^2 + (Bn - An)^2) .

Now, it was said that the elevations of the two points are known so call the
difference in elevation as Df. The vertical angle is InvTan(Df / Ds) .

Finally, if the situation busts UTM zone boundaries then ellipsoid inverse
calculations for direction and distance are going to be needed.

KBH, Sep 23, 2003

3. ### Hal MuellerGuest

Escobal's "Methods of Orbit Determination" (1976) has a nice treatment of
coordinate conversions in the appendix. I think it's still in print.

Hal Mueller, Sep 23, 2003
4. ### steveGuest

I managed to solve the problem and generate an excel spreadsheet that
computes antenna pointing azimuth and elevation from earth station and
aircraft GPS (WGS84) coordinates.

Although this solution seems to work well based upon some specific
simple test cases, there are still some rough edges to work, including
how to avoid trig functions 'blowing up' as well as 'divide by zero'
errors that can be induced at certain latitudes and longitudes I may
move to quaternian methods to avoid these annoying issues. Also I expect
to utilize statistical or Kalman filtering to 'smooth out' the dish
movement commands which will be based on periodic updates of aircraft
location.

The methodology involved first converting the GPS 84 coordinates to a
cartesian 'earth centered' coordinate system, then subtracting the
coordinates to generate a pointing vector, then finally transforming
this vector to a cartesian coordinate system (North, East, Height) based
upon the earth station GPS coordinates. I knew that this solution had
already been done, and I was able to find references to it without
bursting too many blood vessels. If anyone has further interest in this solution, post a message here and

All in all it was a fun exercise that had me lurking in the local
technical library for reference material, and brushing up on my matrix
and linear algebra skills which have become a bit rusty from lack of use.

Regards,

Steve

steve, Sep 24, 2003
5. ### Richard LemayGuest

Steve,
You may want to look at the following link:
http://williams.best.vwh.net/avform.html
While I don't recall seing a formula for elevation, I am sure you would be
able to find a simple formula for the height of the radar horizon at a given
distance and that it would be relatively easy to figure out a simple trig
formula for the elevation.

Richard - ve3spd

Richard Lemay, Sep 26, 2003
6. ### Ed WilliamsGuest

R= radius of earth, (lat,lon,h) aircraft position, (lat0,lon0,h0)
base station. All angles in radians. Lengths in common units.

y =R*(lat-lat0) //Northing
x =R*(lon-lon0)*cos(lat0) // Easting
z =h-h0-(x^2+y^2)/2R // height
azimuth = atan2(x,y)
elevation = atan2(z, sqrt(x^2+y^2))

should be accurate enough, even though it assumes a spherical earth.

http://williams.best.vwh.net/avform.htm#flat

Ed Williams
i

Ed Williams, Sep 26, 2003