I am working on a satellite tracking application where I can read NMEA data from file.

Here are the NMEA sentences I have:

$GPGGA,104427.591,5920.7009,N,01803.2938,E,1,05,3.3,78.2,M,23.2,M,0.0,0000*4A $GPGSA,A,3,05,24,17,30,02,,,,,,,,5.6,3.3,4.5*34 

And where I need help is I have to get the "satellite position" from the sentence in lon/lat.

I know the GSV data contains azimuth and elevation, but I don't now how to convert it to lon/lat coordinates.

Can somebody help me?

  • How precise do you need? The NMEA azimuth/elevation is only to the nearest degree, which probably means doing the full computation with the ephemeris data is a waste of time. And I think most GPS chipsets don't let you get at the precise timing data, doing the navigation calculations on-chip and presenting only the user location and the various bits of metadata you can get via NMEA.
    – Spacedman
    Mar 16, 2018 at 8:25

2 Answers 2


Azimuth and elevation gives you the direction of the satellite. Without knowing the distance you can't locate the satellite in 3 dimensions and hence work out what lat-long it is directly above.

There's some hairy-looking formulae here:


that require the orbital parameters from the ephemeris data. This claims a very accurate (~metres) position. That formula seems to have been converted to C code here: https://www.colorado.edu/geography/gcraft/notes/gps/ephxyz.html

Assuming a spherical earth of radius 6371km and a circular orbit of altitude 20180km above the earth, the distance to a satellite is obtained from a triangle formed from the centre of the earth (C), the observer on the surface (P), and the satellite (S). We know two side lengths - PC is the earth radius, and CS is earth radius plus orbit altitude - and one angle internal to CPS which is the elevation plus 90 degrees. The triangle can be solved using standard textbook formula for the side lengths and angles, giving the distance to the satellite from the observer (PS).

The following diagram shows the triangle shaded in pink.

satellite orbit geometry

Getting the satellite's position in (x,y,z) space will involve a couple of 3d rotations to get the true direction from elevation and azimuth but should be straightforward.

  • I put an example sentence up. Can I get the distance from that data? I have a plus information: I know where I get these datas (phone lon/lat coordinates)
    – gisfan
    Mar 15, 2018 at 18:36
  • I reckon my "approximate" method might be worth asking as a question on the mathematics stack exchange site, with a [geometry] tag.
    – Spacedman
    Mar 16, 2018 at 12:12
  • I've got that working - the distance of a GPS satellite varies from 20180km when overhead to 25775km on the horizon. Below the horizon the distance increases up to 32922km for a satellite under your feet (two earth radii plus an orbital height). A bit more 3d geometry can get the location in space of the satellite but not sure I have time to think about it for a week...
    – Spacedman
    Mar 16, 2018 at 16:31

Recently I made progress on this problem, and will shortly post a blog about the calculation process.

Edit: The post on Esri GeoNet: https://community.esri.com/t5/arcgis-runtime-sdks-blog/positions-of-gps-satellites-in-3d/ba-p/1070293

SoCal satellites Another view

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.