0

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

Here are the NMEA sentences I have:

$GPRMC,104426.591,A,5920.7019,N,01803.2893,E,0.117980,320.93,141204,,*0F 
$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 
$GPGSV,3,1,12,30,72,254,30,05,70,125,39,24,37,083,43,02,36,113,45*7B 
$GPGSV,3,2,12,04,32,059,34,01,27,307,00,14,26,256,00,06,24,219,00*7F 
$GPGSV,3,3,12,17,22,135,40,25,20,311,31,09,19,159,25,20,08,346,34*7C

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 '18 at 8:25
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:

http://www.navipedia.net/index.php/GPS_and_Galileo_Satellite_Coordinates_Computation

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.

| improve this answer | |
  • 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 '18 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 '18 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 '18 at 16:31

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.