code: function GeoJsonEncoder (data) {
      var msg;
  
      switch (data.cmd)  {
          case 1: // Vessel static info (some value might be undefined)
             msg =
             { type: "Feature"
             , geometry:
                { type: "Statics"
                , callsign: data.callsign
                , class:  data.class
                , length: (data.dimB - data.dimA)
                , width:  (data.dimD - data.dimC)
                }
             , properties:
                { "mmsi": data.mmsi
                , 'name': data.shipname
                }
             };
             break;
  
          case 2: // Vessel Position report
              msg =
              { type: "Feature"
                  , geometry:
              { type: "Point"
                  , coordinates: [data.lat, data.lon]
                  , sog: data.sog
                  , cog: data.cog
              }
                  , properties:
                  { "mmsi": data.mmsi
                  , 'name': data.name
                  }
              };
              break;
  
          default: msg= null;
      }
  
      // Note that geojson SHOULD return a valid string/buffer and not an object
      return (JSON.stringify(msg));
  }
docs: /*
  Encoder receives position/statics info about vessel
  Static={type:1, mmsi:xxx, shipname:xxx, ....}
  Position={type:2, lon:xx, lat:xx, sog:xx, cog:xx}
  
  What ever Encoder returns, it going to be sent back to TCP client
  socket.write function accept string or buffer
  
  GeoJson spec http://geojson.org/