ShipTracker is a Python-based application for collecting, enriching, and visualizing real-time and historical ship positions and weather data. It uses AIS (Automatic Identification System) position reports, integrates weather information from Open-Meteo, and displays ship tracks and live status on an interactive Leaflet map.
See the DEMO LIVETRACKING
- Collects AIS position reports for specified ships (MMSI filter)
- Enriches AIS data with current weather and marine conditions
- Stores data in CSV and JSON formats
- Generates GeoJSON tracks for map visualization
- Interactive web map (Leaflet) for viewing ship position, track, and weather
- Configurable monitoring duration and duplicate filtering
ais_ship_tracker_weather.py— Main Python script for data collection and enrichmentconfig.py— Configuration for ship MMSI, monitoring duration, and filteringais_position_reports.csv— Collected AIS and weather dataship_tracks.geojson— Generated ship track data for map visualizationposition_report.json— Latest ship position and weather dataindex.html— Interactive map visualization (Leaflet)secrets/aisstream.json— Local secrets file for AIS API key (not tracked in git).github/workflows/run_ais.yml— GitHub Actions workflow for automation
-
Install dependencies:
pip install -r requirements.txt
-
Set up AIS API key:
- Create a free account at AISstream
- Add your API key to
secrets/aisstream.json(you can find it in your AISstream account):{ "APIKey": "your_api_key_here" }
-
Configure ship(s) to monitor:
- Edit
config.pyand setFILTERS_SHIP_MMSIto your target MMSI(s).
- Edit
-
Run the tracker:
python ais_ship_tracker_weather.py
-
View results:
- Open
index.htmlin your browser to view the map and ship data.
- Open
- CSV: All collected AIS and weather data (
ais_position_reports.csv) - GeoJSON: Ship tracks for visualization (
ship_tracks.geojson) - JSON: Latest ship position and weather (
position_report.json)
See config.py for all available options:
FILTERS_SHIP_MMSI: List of MMSI numbers to monitorMAX_DURATION_MINUTES: How long to monitor the AIS streamTIME_THRESHOLD_HOURS: Duplicate filtering threshold
You can view the ShipTracker demo at
https://davidoesch.github.io/shiptracker/index.html
The map supports permalinks via URL parameters:
-
?zoom=14
Sets the initial zoom level of the map (default is 12). -
?popupzoom=false
Prevents the ship info popup from opening automatically when the page loads (default istrue).
Examples:
- Show map with zoom 14
- Show map with zoom 14 and no popup
- Show map with no popup
- Show map in black and white
Just append the desired parameters to the URL to customize your view and share direct links to specific map states.
This project is licensed under the GNU GPL v3. See LICENSE for details.
For technical details, see the Technical Description.