Skip to content

AISHub to Tracking

This small project was created to read AIS positions from the AISHub service and push them to MBARI's tracking service. I developed this in August of 2024 to try to find a way to track the Packard on it's return journey home. I was going to use Marine Traffic, but their API is really, really expensive and I could not find a way to get them to give me access to the API for a discount even though we provide them with a really high quality AIS feed from Mt. Toro. Anyway, I did find the AISHub service would give us access to their API if we provided them with a feed from our AIS.

So, first, I augmented the grabAISPositions.py script that is running on pismo under the aistrack account. Basically for every AIS fix it gets, it now forwards that information on to the UDP socket that AISHub created for the feed. Once they verified the AIS feed, they included on their site here and then sent me the access information so I could read AIS positions from their API. The documentation for the API describes how to use the straight forward access.

I created the AISHub to Tracking Repository to manage the script to query their service. The script is very straightforward and it basically tries to read the latest AIS positions from their API for vessels listed in a JSON configuration file. It then keeps a local database so it does not send duplicate positions. The connection information for the AISHub service and the AMQP server are set in a shell script that activates a virtual environment, run the python script and then shuts down. It is set to run every two minutes currently under the 'kgomes' account on pismo.