Skip to main content

Automatic Identification System decoding - ship tracking

Project description

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

Automatic Identification System

Other open source AIS projects:

Building

Building with Python

$ python setup.py build
$ python setup.py install

Testing with Python

$ virtualenv ve
$ source ve/bin/activate
$ python setup.py test

Building with CMake

$ cmake .
$ make

Building with legacy Makefile

$ make -f Makefile-custom test

Usage

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

  • ITU-1371, ITU-1371-{1,2,3,4]

  • e-Navigation

  • IMO Circ 236

  • IMO Circ 289

  • EU RIS

Developing

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/

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

or

$ git clone https://github.com/schwehr/libais
$ cd libais
$ virtualenv ve
$ source ve/bin/activate
$ pip install -e .[test]
$ python setup.py develop
$ python setup.py test
$ py.test --cov=ais --cov-report term-missing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libais-0.16.tar.bz2 (128.7 kB view details)

Uploaded Source

File details

Details for the file libais-0.16.tar.bz2.

File metadata

  • Download URL: libais-0.16.tar.bz2
  • Upload date:
  • Size: 128.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for libais-0.16.tar.bz2
Algorithm Hash digest
SHA256 185a7e582637b4c2caa4a65e9c18336a6a7271e6855c631bffda67316681ba91
MD5 592ff41a0e209dde1066e5b6ace37aeb
BLAKE2b-256 63cad7f57a0fe053792852426b5a39d57b2983ae9be6e0de74a73605e610ed66

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page