node-nmea icon indicating copy to clipboard operation
node-nmea copied to clipboard

longitude & latitude stored as strings?

Open ajmas opened this issue 8 years ago • 0 comments

Is there any reason why longitude & latitude are stored as strings, rather than as floats?

Using the following code, with the current latest

var sentences = [
   '$GPRMC,,V,,,,,,,,,,N*53',
   '$GPGGA,,,,,,0,00,99.99,,,,,,*48',
   '$GPGGA,182213.00,4531.14046,N,07334.85370,W,1,10,0.86,54.7,M,-32.6,M,,*58'
]

for (i=0; i<sentences.length; i++) {
    console.log(nmea.parse(sentences[i]));
}

I get the following results:

{ id: 'GPGGA',
  time: '',
  latitude: 'NaN',
  longitude: 'NaN',
  fix: 0,
  satellites: 0,
  hdop: 99.99,
  altitude: NaN,
  aboveGeoid: NaN,
  dgpsUpdate: '',
  dgpsReference: '' }
{ id: 'GPGGA',
  time: '182213.00',
  latitude: '45.51900767',
  longitude: '-73.58089500',
  fix: 1,
  satellites: 10,
  hdop: 0.86,
  altitude: 54.7,
  aboveGeoid: -32.6,
  dgpsUpdate: '',
  dgpsReference: '' }

ajmas avatar May 19 '16 18:05 ajmas