gps.js
function(str, gsa) {

      if (gsa.length !== 19 && gsa.length !== 20) {
        throw new Error('Invalid GSA length: ' + str);
      }

      /*
       eg1. $GPGSA,A,3,,,,,,16,18,,22,24,,,3.6,2.1,2.2*3C
       eg2. $GPGSA,A,3,19,28,14,18,27,22,31,39,,,,,1.7,1.0,1.3*35
       
       
       1    = Mode:
       M=Manual, forced to operate in 2D or 3D
       A=Automatic, 3D/2D
       2    = Mode:
       1=Fix not available
       2=2D
       3=3D
       3-14 = PRNs of Satellite Vehicles (SVs) used in position fix (null for unused fields)
       15   = PDOP
       16   = HDOP
       17   = VDOP
       (18) = systemID NMEA 4.10
       18   = Checksum
       */

      var sats = [];
      for (var i = 3; i < 15; i++) {

        if (gsa[i] !== '') {
          sats.push(parseInt(gsa[i], 10));
        }
      }

      return {
        'mode': parseGSAMode(gsa[1]),
        'fix': parseGSAFix(gsa[2]),
        'satellites': sats,
        'pdop': parseNumber(gsa[15]),
        'hdop': parseNumber(gsa[16]),
        'vdop': parseNumber(gsa[17]),
        'systemId': gsa.length > 19 ? parseNumber(gsa[18]) : null
      };
    }
function(str, gsa) {

      if (gsa.length !== 19 && gsa.length !== 20) {
        throw new Error('Invalid GSA length: ' + str);
      }

      /*
       eg1. $GPGSA,A,3,,,,,,16,18,,22,24,,,3.6,2.1,2.2*3C
       eg2. $GPGSA,A,3,19,28,14,18,27,22,31,39,,,,,1.7,1.0,1.3*35
       
       
       1    = Mode:
       M=Manual, forced to operate in 2D or 3D
       A=Automatic, 3D/2D
       2    = Mode:
       1=Fix not available
       2=2D
       3=3D
       3-14 = PRNs of Satellite Vehicles (SVs) used in position fix (null for unused fields)
       15   = PDOP
       16   = HDOP
       17   = VDOP
       (18) = systemID NMEA 4.10
       18   = Checksum
       */

      var sats = [];
      for (var i = 3; i < 15; i++) {

        if (gsa[i] !== '') {
          sats.push(parseInt(gsa[i], 10));
        }
      }

      return {
        'mode': parseGSAMode(gsa[1]),
        'fix': parseGSAFix(gsa[2]),
        'satellites': sats,
        'pdop': parseNumber(gsa[15]),
        'hdop': parseNumber(gsa[16]),
        'vdop': parseNumber(gsa[17]),
        'systemId': gsa.length > 19 ? parseNumber(gsa[18]) : null
      };
    }
function ( str , gsa ) { if ( gsa . length !== 19 && gsa . length !== 20 ) { throw new Error ( 'Invalid GSA length: ' + str ) ; } /*
       eg1. $GPGSA,A,3,,,,,,16,18,,22,24,,,3.6,2.1,2.2*3C
       eg2. $GPGSA,A,3,19,28,14,18,27,22,31,39,,,,,1.7,1.0,1.3*35
       
       
       1    = Mode:
       M=Manual, forced to operate in 2D or 3D
       A=Automatic, 3D/2D
       2    = Mode:
       1=Fix not available
       2=2D
       3=3D
       3-14 = PRNs of Satellite Vehicles (SVs) used in position fix (null for unused fields)
       15   = PDOP
       16   = HDOP
       17   = VDOP
       (18) = systemID NMEA 4.10
       18   = Checksum
       */ var sats = [ ] ; for ( var i = 3 ; i < 15 ; i ++ ) { if ( gsa [ i ] !== '' ) { sats . push ( parseInt ( gsa [ i ] , 10 ) ) ; } } return { 'mode' : parseGSAMode ( gsa [ 1 ] ) , 'fix' : parseGSAFix ( gsa [ 2 ] ) , 'satellites' : sats , 'pdop' : parseNumber ( gsa [ 15 ] ) , 'hdop' : parseNumber ( gsa [ 16 ] ) , 'vdop' : parseNumber ( gsa [ 17 ] ) , 'systemId' : gsa . length > 19 ? parseNumber ( gsa [ 18 ] ) : null } ; }
GPS DOP and active satellites
GPS DOP and active satellites