GithubHelp home page GithubHelp logo

kornev-online / libais Goto Github PK

View Code? Open in Web Editor NEW

This project forked from schwehr/libais

0.0 0.0 0.0 2.5 MB

C++ decoder for Automatic Identification System for tracking ships and decoding maritime information

License: Other

Shell 0.09% C++ 66.57% Python 30.31% Makefile 1.63% CMake 0.11% M4 1.28%

libais's Introduction

Introduction

https://travis-ci.org/schwehr/libais.svg?branch=master

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', 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 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

libais's People

Contributors

andyvan-trabus avatar cchayden avatar cpetrich avatar davoli avatar geowurster avatar ianfixes avatar jamtho avatar kthy avatar lancelotsix avatar lsix avatar lukec avatar rolker avatar rutsky avatar schwehr avatar skarlsson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.