From 2707e926b9e06a6bd82c571388603a816bfc72ac Mon Sep 17 00:00:00 2001 From: Christoph Reimers Date: Thu, 28 Feb 2019 11:54:52 +0100 Subject: [PATCH 1/2] fix readme path in setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ae7660e..b3fc2f4 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -with open('README.rst') as r: +with open('README.md') as r: readme = r.read() setup(name='simpleais', From a4230d05c0336b589996a3674832d730f8b4f351 Mon Sep 17 00:00:00 2001 From: Christoph Reimers Date: Thu, 28 Feb 2019 12:03:55 +0100 Subject: [PATCH 2/2] added install and additional usage instructions --- README.md | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ce185f5..7474d30 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,15 @@ tests/sample.ais. Contributions welcome. -## Library usage +## Quickstart + +### Installation + +You can install the latest version of this library by running + +`pip install https://github.com/wpietri/simpleais/archive/master.zip`. + +### Library usage Here's an example, a simplified version of the `aist` tool, which prints one line per complete AIS message: @@ -52,6 +60,35 @@ fields can all be referred to by name. For example, `sentence['mmsi']` or `sentence['shipname']`. The `location()` method will return a tuple of the form `(longitude, latitude)`. Missing or invalid fields will return `None`. +Here's another example of how to use the library: + +``` +import simpleais + +result = simpleais.parse("!AIVDM,1,1,,B,177KQJ5000G?tO`K>RA1wUbN0TKH,0*5C") + +print(result.as_json()) + +"{'accuracy': False, + 'course': 51.0, + 'heading': 181, + 'ignored-145': 0, + 'lat': 47.5828, + 'lon': -122.3458, + 'maneuver': 'enum-0', + 'mmsi': '477553000', + 'radio': 149208, + 'raim': False, + 'repeat': 0, + 'second': 15, + 'speed': 0.0, + 'status': {'enum_id': 5, 'enum_value': 'Moored'}, + 'text': ['!AIVDM,1,1,,B,177KQJ5000G?tO`K>RA1wUbN0TKH,0*5C'], + 'turn': 0.0, + 'type': 1}" + +``` + ## Command-line usage