Giter Site home page Giter Site logo

node-nmea's Introduction

node-nmea

npm version npm downloads Build Status Coverage Status Maintainability dependencies Status devDependencies Status

Parser for NMEA sentences.

Available sentences:

  • GPRMC - recommended minimum data for gps
  • GPGGA - time, position, and fix related data

Example: $GPRMC,161006.425,A,7855.6020,S,13843.8900,E,154.89,84.62,110715,173.1,W,A*30

Where:

Value Definition
161006.425 Time in UTC 16:10:06.425
A Status A=active or V=Void.
7855.6020,S Latitude 78°55.6020' N
13843.8900,E Longitude 138°43.8900' E
154.89 Speed over the ground in knots
84.62 Track angle in degrees True
110715 Date - 11 of July 2015
173.1,W Magnetic Variation in degrees (- West Declination, + East Declination)
A FAA Mode A=autonomous, D=differential, E=estimated (dead-reckoning), M=manual input, S=simulated, N=data not valid, P=precise (4.00 and later)
*30 The checksum data, always begins with *

Example: $GPGGA,120558.916,5058.7457,N,00647.0514,E,2,06,1.7,109.0,M,47.6,M,1.5,0000*71

Where:

Value Definition
120558.916 Time in UTC 12:05:58.916
5058.7457,N Latitude 50°58.7457' N
00647.0514,E Longitude 6°47.0514' E
2 Gps quality. 0=Invalid, 1=GPS fix (SPS), 2=DGPS fix, 3=PPS fix, 4=Real Time Kinematic, 5=Float RTK, 6=estimated (dead reckoning) (2.3 feature), 7=Manual input mode, 8=Simulation mode
06 Number of satellites
1.7 HDOP
109.0,M Altitude in meters
47.6,M Geoidal Separation in meters
1.5 Age Gps data in seconds
0000 Reference Station Id
*71 The checksum data, always begins with *

Installation

$ npm install @drivetech/node-nmea

Use

Try on RunKit

const nmea = require('@drivetech/node-nmea')

const raw = '$GPRMC,161006.425,A,7855.6020,S,13843.8900,E,154.89,84.62,110715,173.1,W,A*30'
const data = nmea.parse(raw)
data.valid // true
data.raw // '$GPRMC,161006.425,A,7855.6020,S,13843.8900,E,154.89,84.62,110715,173.1,W,A*30'
data.type // 'RMC'
data.gps // true
data.datetime // Sat Jul 11 2015 13:10:06 GMT-0300 (CLT)
data.loc // { geojson: { type: 'Point', coordinates: [ 138.7315, -78.9267 ] }, dmm: { latitude: '7855.6020,S', longitude: '13843.8900,E' } }
data.speed // { knots: 154.89, kmh: 286.85627999999997 }
data.track // '84.62'
data.magneticVariation // '173.1,W'
data.mode // 'Autonomous'

License

MIT

node-nmea's People

Contributors

gitter-badger avatar greenkeeper[bot] avatar greenkeeperio-bot avatar lgaticaq avatar renovate-bot avatar renovate[bot] avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

node-nmea's Issues

TypeError: Cannot read property 'date' of null

On the following line:
$GPRMC,102939.000,A,4241.2649,N,02318.6959,E,2.87,50.45,260815,,*33
I get:
/home/lukav/Projects/gtsd/node_modules/node-nmea/lib/index.js:216
var datetime = r.date + " " + r.time + " +00:00";
^
TypeError: Cannot read property 'date' of null
at Object.parse (/home/lukav/Projects/gtsd/node_modules/node-nmea/lib/index.js:216:19)
at ProcessPack (/home/lukav/Projects/gtsd/server.js:67:30)
at ProcessData (/home/lukav/Projects/gtsd/server.js:48:9)
at Socket. (/home/lukav/Projects/gtsd/server.js:25:5)
at Socket.emit (events.js:95:17)
at Socket. (stream_readable.js:765:14)
at Socket.emit (events.js:92:17)
at emitReadable
(_stream_readable.js:427:10)
at emitReadable (_stream_readable.js:423:5)
at readableAddChunk (_stream_readable.js:166:9)

The module is installed from npm

How to parse GPGSA?

Can node-nmea support these?

GGA ,GLL,GSA,GSV,RMC,VTG,ZDA

And
GP ,GN , GL ,BD

  1. The prefix identifier “GP” refers to the GPS global navigation system;
  2. Prefix identification “GN” refers to the GNSS global navigation system (collectively referred to as various global navigation systems);
  3. Prefix identification “GL” refers to the GLONASS global navigation system;
  4. Prefix identifier “BD” refers to the BeiDou global navigation system.

Wrong magnetic variation and cordinates

on the following input:
$GPRMC,102939.000,A,4241.2649,N,02318.6959,E,2.87,50.45,260815,,_33
the parse funcition returns:
{ raw: '$GPRMC,102939.000,A,4241.2649,N,02318.6959,E,2.87,50.45,260815,,_33',
type: 'RMC',
datetime: Wed Aug 26 2015 13:29:39 GMT+0300 (EEST),
loc:
{ type: 'Point',
coordinates: [ 23.311598333333336, 42.68774833333334 ] },
speed: 5.31524,
track: '50.45',
magneticVariation: ',',
mode: null }

Here magnetic variation should be empty since it is missing in the line.

The cordinates seams to suffer from floating point rounding problem, but I'm not sure if this is a real problem.
Since I want to store those in DB I think there should be an option to chose how the cordinates and speed should be transformed.

Great work.

When there is no valid fix the messege is not parsed

Today the gps returned the folloing string:
$GPRMC,150449.000,L,4239.5210,N,02318.7727,E,39.75,326.93,040915,,*38

parse function decode this to:
{ raw: '$GPRMC,150449.000,L,4239.5210,N,02318.7727,E,39.75,326.93,040915,,*38',
valid: false }
Although there is no valid GPS fix from the satellite the data still can be parsed and the coordinates set

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm eslint-plugin-standard Unavailable
npm npm-github-config Unavailable

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency eslint-plugin-standard to v5
  • chore(deps): update dependency husky to v9
  • chore(deps): update dependency lint-staged to v15
  • chore(deps): update dependency mocha to v10
  • chore(deps): update dependency node to v20
  • chore(deps): update dependency nyc to v17
  • 🔐 Create all rate-limited PRs at once 🔐

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • @commitlint/cli 7.6.1
  • @commitlint/config-conventional 7.6.0
  • @commitlint/prompt-cli 7.6.1
  • @semantic-release/changelog 3.0.6
  • @semantic-release/git 7.0.18
  • @semantic-release/github 5.5.8
  • @semantic-release/npm 5.3.5
  • chai 4.4.0
  • eslint 5.16.0
  • eslint-config-standard 12.0.0
  • eslint-plugin-import 2.29.1
  • eslint-plugin-node 8.0.1
  • eslint-plugin-promise 4.3.1
  • eslint-plugin-standard 4.1.0
  • husky 1.3.1
  • lint-staged 8.2.1
  • mocha 5.2.0
  • npm-github-config 2.0.1
  • nyc 13.3.0
  • nyc-config-common 1.0.1
  • prettier-standard 8.0.1
  • semantic-release 15.14.0
  • node >=8
nvm
.nvmrc
  • node v10
travis
.travis.yml
  • node 10
  • node 10
  • node 8

  • Check this box to trigger a request for Renovate to run again on this repository

randomData() produces ReferenceError: Symbol is not defined

I tried to use the function getChecksum and discovered that it doesn't work.
The problem is reviewed in randomData also:
node

var n = require('node-nmea');
undefined
n.randomData();
ReferenceError: Symbol is not defined
at getChecksum (/home/lukav/Projects/gtsd/node_modules/node-nmea/lib/index.js:40:36)
at Object.randomData (/home/lukav/Projects/gtsd/node_modules/node-nmea/lib/index.js:308:18)
at repl:1:3
at REPLServer.self.eval (repl.js:110:21)
at repl.js:249:20
at REPLServer.self.eval (repl.js:122:7)
at Interface. (repl.js:239:12)
at Interface.emit (events.js:95:17)
at Interface._onLine (readline.js:203:10)
at Interface._line (readline.js:532:8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.