code: function NmeaEncode (msg) {
      this.nmea =[];
      var lato,lono;
  
      switch (msg.msgtype || 2) {// default value is GPRMC
          case 2:  // Ais class A position report
              if (msg.lat < 0) lato="S"; else lato='N';
              if (msg.lon < 0) lono="W"; else lono="E";
  
              this.EncodeDate();
  
              var packet =util.format ("$GPRMC,%s.00,A,%s,%s,%s,%s,%s,%s,%s,,,A"
                  , this.time, this.Dec2Min(msg.lat,2),lato, this.Dec2Min(msg.lon,3), lono, msg.sog, msg.cog, this.date);
  
              var checksum = 0; // http://rietman.wordpress.com/2008/09/25/how-to-calculate-the-nmea-checksum/
              for(var i = 1; i < packet.length; i++) {
                  checksum = checksum ^ packet.charCodeAt(i);
              }
              var trailer=util.format ("*%s", checksum.toString(16)).toUpperCase();
              this.nmea= packet + trailer;
              this.valid=true;
              break;
  
          default:
              // not implemented
              this.valid=false;
              break;
      }
  
  }
docs: Map AIS class A/B position report on a GPRMC NMEA paquet