Norwegian Kystverket publish AIS data for ship positions that can be used under NLOD license. This application stores the positions received and present current situation and history in a Map using Leaflet.
This demo is made using Python with Flask for the web server part, Leaflet/HTML for the presentation and postgis for the database. AIS position data is read from a TCP connection continously using Python library pyais. The position updates are stored in a postgis database using two tables: LastPositionReport and HistoricPosition.
Docker compose is used for deploymnet
docker compose up -d --build
Web interface accessible on http://localhost:9101
The application can be configured by providing environment variables or a dotenv file called .spartid-ais.env
in the root directory.
For available settings see:
Example .spartid-ais.env
MAP__ZOOM=16
MAP__CENTER__LONG=10.611268532369081
MAP__CENTER__LAT=59.669607206900906
docker exec spartid-ais-db-1 pg_dump -U postgres spartid_ais | gzip > /srv/db-backups/posgtres/spartid_ais/spartid_ais-$(date +%Y-%m-%d).tar.gz