{"id":13711918,"url":"https://github.com/BertoldVdb/go-ais","last_synced_at":"2025-05-06T21:32:46.218Z","repository":{"id":37251482,"uuid":"168998078","full_name":"BertoldVdb/go-ais","owner":"BertoldVdb","description":"Automatic Identification System (ITU-R M.1371-5) packet decoder and encoder written in Go","archived":false,"fork":false,"pushed_at":"2024-10-23T14:40:11.000Z","size":1465,"stargazers_count":60,"open_issues_count":3,"forks_count":21,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-29T09:47:04.391Z","etag":null,"topics":["ais","go","golang","nmea","nmea0183"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BertoldVdb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-03T21:55:46.000Z","updated_at":"2025-04-25T03:51:54.000Z","dependencies_parsed_at":"2024-05-15T12:12:23.071Z","dependency_job_id":"d0760d1b-4cfd-4f41-950e-82c3adfa76ca","html_url":"https://github.com/BertoldVdb/go-ais","commit_stats":null,"previous_names":["bertoldvdb/goais"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BertoldVdb%2Fgo-ais","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BertoldVdb%2Fgo-ais/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BertoldVdb%2Fgo-ais/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BertoldVdb%2Fgo-ais/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BertoldVdb","download_url":"https://codeload.github.com/BertoldVdb/go-ais/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252772216,"owners_count":21801878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ais","go","golang","nmea","nmea0183"],"created_at":"2024-08-02T23:01:12.945Z","updated_at":"2025-05-06T21:32:43.785Z","avatar_url":"https://github.com/BertoldVdb.png","language":"Go","funding_links":[],"categories":["Repositories"],"sub_categories":[],"readme":"\n# go-ais\n\n[![Build Status](https://travis-ci.org/BertoldVdb/go-ais.svg?branch=master)](https://travis-ci.org/BertoldVdb/go-ais)\n[![Coverage Status](https://coveralls.io/repos/github/BertoldVdb/go-ais/badge.svg?branch=master)](https://coveralls.io/github/BertoldVdb/go-ais?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/bertoldvdb/goais)](https://goreportcard.com/report/github.com/bertoldvdb/goais)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n**Summary**\n\nThis is a library written in [Go](https://golang.org/) to encode and decode Automatic Identification System packets. This is a VHF data system that is used for dependent tracking and identification of marine vessels. It is specified by the [ITU-R M.1371-5](https://www.itu.int/rec/R-REC-M.1371-5-201402-I/en) standard.\n\n**Rationale**\n\nThere are a few other libraries offered on the internet, but all of them implement only a few messages (usually the position and static reports). In addition, very few libraries support encoding.\n\nMany other libraries tightly integrate a NMEA (VDM/VDO) decoder with the AIS decoder. This is handy if you use a complete receiver that delivers NMEA sentences, but can be limiting. For example, you may have a low level RF receiver connected directly to an embedded system. I feel it is best to split NMEA and AIS coding as they are really two different functions. However, a convenience library is provided in this repository that combines this library with a golang NMEA decoder and a self-developed NMEA encoder.\n\n**How to use it**\n\nStart by getting an AIS packet from somewhere. It could for example come from [AISHub](http://www.aishub.net/) or a local receiver. Extract the payload and convert it to a byte slice containing one bit per byte. Then call the DecodePacket function on it. It will return an object containing the decoded message. For example:\n```go\npackage main\n     \nimport (\n    \"fmt\"\n    \"encoding/json\"\n \n    ais \"github.com/BertoldVdb/go-ais\"\n)\n    \nfunc main() {\n    msg := []byte{0, 0, ... 1, 0, 0, 0, 0, 0, 0, 0}\n    \n    c := ais.CodecNew(false, false)\n    c.DropSpace = true\n       \n    result := c.DecodePacket(msg)\n    out, _ := json.MarshalIndent(result, \"\", \"  \")\n    fmt.Printf(\"%T: %s\\n\", result, out)\n}   \n ```\n \nThe output of this program could be as follows:\n\u003e ais.ShipStaticData: {  \n\u003e \"MessageID\": 5,  \n\u003e \"RepeatIndicator\": 0,  \n\u003e \"UserID\": 203999421,  \n\u003e \"Valid\": true,  \n\u003e \"AisVersion\": 0,  \n\u003e \"ImoNumber\": 0,  \n\u003e \"CallSign\": \"OED3018\",  \n\u003e \"Name\": \"PRIMADONNA\",  \n\u003e \"Type\": 69,  \n\u003e \"Dimension\": {  \n\u003e \"A\": 20,  \n\u003e \"B\": 93,  \n\u003e \"C\": 7,  \n\u003e \"D\": 10  \n\u003e },  \n\u003e \"FixType\": 1,  \n\u003e \"Eta\": {  \n\u003e \"Month\": 1,  \n\u003e \"Day\": 4,  \n\u003e \"Hour\": 18,  \n\u003e \"Minute\": 30  \n\u003e },  \n\u003e \"MaximumStaticDraught\": 1.7,  \n\u003e \"Destination\": \"LINZ\",  \n\u003e \"Dte\": false,  \n\u003e \"Spare\": false  \n\u003e }\n\nTo encode a packet, call the EncodePacket function. It works exactly in the opposite way of DecodePacket.\n\nIf you want to work with NMEA sentences you can use the following example to decode a packet:\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/BertoldVdb/go-ais\"\n    \"github.com/BertoldVdb/go-ais/aisnmea\"\n)\n\nfunc main() {\n    nm := aisnmea.NMEACodecNew(ais.CodecNew(false, false))\n    \n    decoded, _ := nm.ParseSentence(\"!AIVDM,1,1,,B,33aEP2hP00PBLRFMfCp;OOw\u003cR\u003e`\u003c,0*49\")\n    if decoded != nil {\n        fmt.Printf(\"%+v\\n\", decoded.Packet)\n    }\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBertoldVdb%2Fgo-ais","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBertoldVdb%2Fgo-ais","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBertoldVdb%2Fgo-ais/lists"}