Package Exports
- ais-decoder-ts
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ais-decoder-ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
AIS Decoder
The automatic identification system (AIS) is an automatic Tracking system used on ships and by vessel traffic services (VTS). When satellites are used to detect AIS signatures, the term Satellite-AIS (S-AIS) is used. AIS information supplements marine radar, which continues to be the primary method of collision avoidance for water transport.
References:
- Gov:
- Gpsd:
- http://catb.org/gpsd/AIVDM.html [best doc]
- OpenCPN:
- https://github.com/OpenCPN/OpenCPN [file: AIS_Bitstring.cpp]
- online AIS decoder:
- Wikipedia:
- OpenCPN
- http://arundale.com/docs/ais/ais_decoder.html
AIS MESSAGES
- Position[0]
format
: !AIVDM, identifies this as an AIVDM packet (AIS format). - Position[1]
message_count
: Messages counter (number of messages), sometimes the ais messages will be split over several messages. - Position[2]
message_id
: - Position[3]
sequence_id
: Sequential message, the current message number - Position[4]
channel
: vhf channel A/B - Position[5]
payload
: the ais data itself - Position[6]
size
: number of bits required to fill the data
<format>,<message count>,<message id>,<sequence id>,<channel A/B>,<data>,<fill bits>
Important notes:
- Ais payload is represented in a 6bits encoded string
API
constructor(AIS_Messages, safeMode)
AIS_Messages
: Array of ais messages.safeMode
: set tofalse
by default. when true the module will never throw an error (silent mode).
getResults()
- return a collection of the parse messagesprivate decode(input: Array<any>, session: any): void
- decode the raw ais messagesprivate validateRawMessage(input: string): boolean
- validate if the raw messages
Running example:
npm run example
Example:
// new Decoder(Array<AIS_Messages>, safeMode<Boolean>)
import { Decoder } from '../lib/index';
const aisMessages:Array<string> = [
'!AIVDM,1,1,,A,400TcdiuiT7VDR>3nIfr6>i00000,0*78',
'!AIVDM,2,1,0,A,58wt8Ui`g??r21`7S=:22058<v05Htp000000015>8OA;0sk,0*7B',
'!AIVDM,2,2,0,A,eQ8823mDm3kP00000000000,2*5D',
'!AIVDM,2,1,0,A,58wt8Ui`g??r21`7S=:22058<v05Htp000000015>8OA;0sk,0*7B ',
'!AIVDM,2,2,0,A,eQ8823mDm3kP00000000000,2*5D',
];
const safeMode = false;
const aisDecoder_ex2 = new Decoder(aisMessages, safeMode);
// results will hold a collection of the parsed ais messages
const results = aisDecoder_ex2.getResults();
TODO:
- Parse Latitude and Longitude for Type 27
Bugs & PR's
- If you find any bug please feel free to open an issue. PR are always welcome.