# How to calculate the angle between the satellite and ground station?

I have the latitude/longitude/altitude of a satellite and a ground station. Also, I have their Cartesian coordinates in Earth-centered-Earth-fixed frame (ECEF).

How to calculate the elevation angle between the satellite and ground station? The reference to modules in python also applicable.

• @uhoh I have the latitude/longitude/altitude both for satellite and ground station. – Leeloo Mar 28 '18 at 7:20
• @uhoh Also, I have derived the Cartesian coordinates in ECEF – Leeloo Mar 28 '18 at 7:26
• @uhoh Yes, I'm interested in math. However, I have the TLE files also. Would be happy, if you add it in the answer ;) – Leeloo Mar 28 '18 at 7:35
• For the TLE, see this answer and the Skyfield documentation for its .altaz() method and as I've used it here and here and here. For the math, there may or may not be an answer here already, I'm not sure, but it might be worth a search here. – uhoh Mar 28 '18 at 7:49
• @uhoh Thanks! One question: it's stated that results in GCRS. Is it different from J2000 frame? – Leeloo Mar 28 '18 at 8:18

if you have lat/long, you also need altitude of both.

if you have Cartesians G for the ground station and S for the satellite, create the vectors $\vec z=0 \to G$, and $\vec s=G \to S$

$\vec z$ is the zenith (going straight up) at the ground station.

find the "zenith angle" of the satellite, by finding the angle beetween the vectors $\epsilon=acos\left(\frac{\vec z \cdot \vec s}{|\vec g|*|\vec s|}\right)$

the elevation angle is $90-\epsilon$

Edited to Add: As uhoh points out, the above gives the astronomic zenith and elevation angles but the local zenith (well, nadir actually) doesn't necessarily go through Earth's centre of mass. To obtain the geodetic zenith angle I think you substitute in the ground station latitude and longitude: $\epsilon=acos\left(\frac{\vec s_xcos(lat)cos(long)+\vec s_ycos(lat)sin(long)+\vec s_zsin(lat)}{\left\vert\vec g\right\vert\times\left\vert\vec s\right\vert}\right)$

but take that with a pinch of salt, If it doesn't produce very similar results to the above I've made a mistake.

• "Zenith" as well as "nadir" are really subtle concepts, as are "up" and "down". See here and here for example. How are you defining zenith or elevation angle here? – uhoh Mar 28 '18 at 8:32
• You will see zenith is defined as from the centre of the ECEF co-ordinate space. this will vary by a known amount from the local zenith at the ground station. – JCRM Mar 28 '18 at 8:54
• Great, thanks! Since we live on a lumpy ellipsoid, it's helpful to remember that all zeniths aren't the same. – uhoh Mar 28 '18 at 9:01