Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
C++ decoder for Automatic Identification System for tracking ships and decoding maritime information
C++ Python Makefile HTML CMake

Merge branch 'dev' - Add NMEA messages and minor cleanup.

- Add NMEA messages ABK, ADS, BBM, TXT
- Linting
- Fix entry_point
- Cleanup GGA and ZDA parsers
latest commit 82eb363c8d
@schwehr authored
Failed to load latest commit information.
ais Add msg, talker, zone_{hours,minutes} to ZDA and msg to GGA.
bin Better error handling
docs Spelling and cleanup formatting
m4 An autoconf m4/bash macro to configure libais for other libraries. C+…
src Add in the decode_body and vdm tests and bring back pthread flag for …
test Add msg, talker, zone_{hours,minutes} to ZDA and msg to GGA.
third_party Remove .svn
utils Bugfix for collecttypes
.codeclimate.yml Remove leading comment about location of this file.
.gitignore Moved compatibility tests to follow the common structure
.travis.yml Only do C++ gunit tests with python 3.4 (schwehr/libais#87)
AUTHOR.txt Switch license to Apache 2.0. Version 0.14
CMakeLists.txt Starting over on cmake support
ChangeLog.html ChangeLog for release 0.15
LICENSE Cleanup license file
MANIFEST.in Replacing every x/y pair with a dedicated Ais class instance. Add tes…
Makefile-custom Use g++-5 for coverity scan
Makefile.am Start to autoconf build
README.org Had svg and link backwards.
TODO.org factor out header initialization of mmsi, repeat and mmsi, plus more …
VERSION Replacing every x/y pair with a dedicated Ais class instance. Add tes…
ais_lut.py cleanup white space
configure.ac Start to autoconf build
create.sql Fixed getType so that it is now a const method
maritime_id_codes.py cleanup white space
nagios_pg_ais.py Switch license to Apache 2.0. Version 0.14
nais2pg.py Fix ais.decode' exception so that it appears as ais.DecodeException (…
send_data.py Replacing every x/y pair with a dedicated Ais class instance. Add tes…
setup.py Add missing comma between entry_point lines.

README.org

Introduction

https://travis-ci.org/schwehr/libais.svg?branch=master https://scan.coverity.com/projects/5519/badge.svg https://codeclimate.com/github/schwehr/libais/badges/gpa.svg https://badge.fury.io/py/libais.svg

Library for decoding maritime Automatic Identification System messages.

See Also

http://en.wikipedia.org/wiki/Automatic_Identification_System

Other open source AIS projects:

Building

Building with legacy Makefile

make -f Makefile-custom test

Building with python

python setup.py build
python setup.py install

Building with CMake

cmake .
make

Usage

ipython

There are two interfaces to libais, one high-level iterator based one and a low-level fast C++ only one. The iterator based interface is accessed the following way:

import ais.stream
with open("file.nmea") as f:
    for msg in ais.stream.decode(f):
        print msg

To use the low-level C++ interface directly, you need to handle multi-line messages and padding yourself:

import ais
ais.decode('15PIIv7P00D5i9HNn2Q3G?wB0t0I', 0)
ais.decode('402u=TiuaA000r5UJ`H4`?7000S:', 0)
ais.decode('55NBjP01mtGIL@CW;SM<D60P5Ld000000000000P0`<3557l0<50@kk@K5h@00000000000', 0)

There is also support for converting parsed messages to the structure output by GPSD / gpsdecode. For full compatibility, you have to write the resulting message dictionaries to a file with json.dump() and add a newline after each message.

import ais.stream
import json
import ais.compatibility.gpsd

with open("infile.nmea") as inf:
    with open("outfile.gpsd") as outf:
        for msg in ais.stream.decode(f):
            gpsdmsg = ais.compatibility.gpsd.mangle(msg)
            json.dump(gpsdmsg, outf)
            outf.write("\n")

AIS Specification Documents

Hacking

The C++ code was switched to the Google style in November, 2012. Indenting should be by 2 spaces.

http://google-styleguide.googlecode.com/svn/trunk/cpplint/

Something went wrong with that request. Please try again.