github.com/rdeg/loc (go): Package loc converts an NMEA-0183 stream into compiled fixes.  At the end of each NMEA cycle, a new fix is compiled and a LocInfo structure is delivered on a channel. This channel is created on user's behalf when the Init function is called.  The LocInfo structure gives information about the quality of the fix (navigation mode, DOPs, etc.), time, actual location (latitude, longitude, elevation), speed, heading as well as the characteristics of the satellites in view and used for the solution.  A typical usage would look like the following code.  The NMEA-0183 stream generated by GPS/GNSS receivers is well known and documented. In general, a number of NMEA 'sentences' are output every second or couple of seconds by the receiver on a serial or USB link. For a given receiver, the sentences are usually repeated identically in each cycle, at least as far as their 'types' (GPRMC, GPGGA and so) are concerned. For instance:  In this example, each cycle consists in a sequence of GPRMC, GPCCA, GPGSA and GPGSV sentences issued every second. The number of GPGSV sentences may vary, depending on the actual number of satellites sensed by the receiver (in-view satellites).  The output of loc for the two cycles given above could print as:  See examples/feed/feed.go for details.  The NMEA standard was originally designed for 4800 baud serial links. The communication was certainly robust but not really adapted to the supply of a quantity of information a little bigger than the bare minimum. As a result, the display of information on satellites in view quickly posed a problem to manufacturers of GPS receivers.  At that time, it was difficult to expect to process more than a dozen satellites, but this still involved sending up to 3 GPGSV messages on the serial link, in addition to the almost mandatory GPGGA, GPRMC and GPGSA: at 2 milliseconds per character, it was tricky to pass all the information of a GPS fix in less than a second. As a result, each manufacturer developed its own strategy to solve the problem.  Some chose to send all the information but only every two seconds. To further relieve the serial link, they could also decide to send the GPGSV messages only once in five. Finally, some manufacturers chose to send only one GPGSV per cycle, thereby creating a sort of 'super cycle' during which all GPGSVs are sent.  The output of some old GPS receivers that issue a single GPGSV message per NMEA cycle is not handled very gracefully by this package. In this situation, the satellites are cleared when the first GPGSV sentence of a 'super cycle' is encoutered and only the cycle containing the last GPGSV sentence will give a fix with the actual number of satellites.  For illustration, here is the output of a Garmin GPS receiver made in 2005 and its interpretation by loc:  This package has been loosely inspired by the work of the NMEA library project at SourceForge:  It is also based on work carried out at ACTIA PCs (http://www.actia-pcs.fr/en/) as part of the EBSF 2 project (http://ebsf2.eu/).
Keywords: geolocation|golang|golang-library|loc|nmea-parser