skip to navigation
skip to content

libais 0.17

Automatic Identification System decoding - ship tracking

Library for decoding maritime Automatic Identification System messages.


Building with Python

$ python build
$ python install

Testing with Python

$ virtualenv ve
$ source ve/bin/activate
$ python test

Building with CMake

$ cmake .
$ make

Building with legacy Makefile

$ make -f Makefile-custom test


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:

with open("file.nmea") as f:
    for msg in
        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', 2)

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 json
import ais.compatibility.gpsd

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

AIS Specification Documents

  • ITU-1371, ITU-1371-{1,2,3,4]
  • e-Navigation
  • IMO Circ 236
  • IMO Circ 289
  • EU RIS


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

$ git clone
$ cd libais
$ virtualenv ve
$ source ve/bin/activate
$ pip install -e .[tests]
$ python test
$ py.test --cov=ais --cov-report term-missing


$ git clone
$ cd libais
$ virtualenv ve
$ source ve/bin/activate
$ pip install -e .[test]
$ python develop
$ python test
$ py.test --cov=ais --cov-report term-missing
File Type Py Version Uploaded on Size
libais-0.17.tar.gz (md5) Source 2018-01-17 153KB