ais-json

0.1.2 • Public • Published

AIS Logo

ais-json

Downloads Version License

ais-json

A npm package about AIS (Automatic Identification System) text decoding.

Decode AIS text, then return JSON object.

npm address: https://www.npmjs.com/package/ais-json

Structure

Name Description
index.js main function (call decode.js and include verify ais text)
encode.js generate ascii6bit.json and num2char.json
decode.js decode ais text and return json (base on ascii6bit.json and num2char.json)
ascii6bit.json connect ascii to 6 bit code
num2char.json connect number to char

Install

npm install ais-json

Usage

In Terminal

npx ais '!AIVDM,1,1,,A,15Cgah00008LOnt>1Cf`s6NT00SU,0*3D'

Then, you will get:

{
  "MessageID": {
    "name": "消息ID",
    "data": 1,
    "info": "船位报告"
  },
  "DataIndicator": {
    "name": "转发指示符",
    "data": 0,
    "info": "默认"
  },
  "UserID": {
    "name": "用户ID(MMSI)",
    "data": 356248000,
    "info": 356248000
  },
  "NaviStatus": {
    "name": "导航状态",
    "data": 0,
    "info": "发动机使用中"
  },
  "ROT": {
    "name": "旋转速率",
    "data": "0°/min",
    "info": "0°/min"
  },
  "SOG": {
    "name": "地面航速",
    "data": "0节",
    "info": "0节"
  },
  "Accuracy": {
    "name": "地面航速",
    "data": 0,
    "info": "高(<10m)"
  },
  "Location": {
    "name": "坐标",
    "data": [118.07354333333333, 24.502496666666666],
    "info": "E 118°4.4126′ , N 24°30.1498′"
  },
  "COG": {
    "name": "地面航线",
    "data": "228.4°",
    "info": "228.4°"
  },
  "Heading": {
    "name": "实际航向",
    "data": "207°",
    "info": "207°"
  },
  "Second": {
    "name": "时戳",
    "data": 18,
    "info": "18 seconds past the minute"
  },
  "RegionalApplication": {
    "name": "特定操纵指示符",
    "data": 0,
    "info": "不可用"
  },
  "Spare": {
    "name": "备用",
    "data": 0,
    "info": "未使用"
  },
  "RAIM": {
    "name": "RAIM",
    "data": 0,
    "info": "RAIM未使用"
  },
  "CommunicationState": {
    "name": "通信状态",
    "data": "0000000100011100101",
    "info": "SOTDMA 4:57 UTC"
  },
  "text": "!AIVDM,1,1,,A,15Cgah00008LOnt>1Cf`s6NT00SU,0*3D"
}

In Project

Decode AIS Text

# const ais = require('ais-json') 
import ais from 'ais-json'
let aisinfo = ais('!AIVDM,1,1,,A,15Cgah00008LOnt>1Cf`s6NT00SU,0*3D')

Open SerialPort

If you need it.

node-serialport

cd ais-json
node serialport

Default

Port: COM3
BaudRate: 38400

Encode Table

cd ais-json
node encode

Generate ascii6bit.json and num2char.json.

Intend

  • CLI

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i ais-json

    Weekly Downloads

    0

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    26.9 kB

    Total Files

    7

    Last publish

    Collaborators

    • yunyoujun