Convert GPS track files (KML/GPX) into professional route visualization outputs:
Run the parsing script to extract coordinates and compute statistics:
bash
python scripts/parse_track.py <input.kml|input.gpx> -o track_data.json
This produces a JSON file containing:
lat, lon, ele, cumulative dist)Choose output format based on user request:
Generate a printable/static route map image:
bash
python scripts/plot_static.py track_data.json -o route_map.jpg --dpi 150
Output layout:
Generate a browser-based interactive map:
bash
python scripts/plot_interactive.py track_data.json -o route_map.html
Features:
For quick generation, chain the scripts:
bash
# Static JPG
python scripts/parse_track.py input.gpx -o track_data.json && python scripts/plot_static.py track_data.json -o route_map.jpg
# Interactive HTML
python scripts/parse_track.py input.gpx -o track_data.json && python scripts/plot_interactive.py track_data.json -o route_map.html
Required Python packages:
bash
pip install matplotlib numpy folium Pillow
matplotlib: Static plotting and image generationnumpy: Numerical operations for statisticsfolium: Interactive Leaflet HTML map generationPillow: Image handling (usually installed with matplotlib)All scripts use only the Python standard library plus the above packages.
ScriptPurposeInputOutputscripts/parse_track.pyParse KML/GPX, compute stats.kml or .gpx``track_data.json``scripts/plot_static.pyGenerate static JPGtrack_data.json``.jpg imagescripts/plot_interactive.pyGenerate interactive HTMLtrack_data.json``.html page
<coordinates> elements inside <LineString> (handles both KML 2.1 and 2.2 namespaces)<trkpt> elements with lat/ lon attributes and <ele> child elements (GPX 1.1)For detailed format specifications, see references/formats.md.
--dpi 300) for print-quality output