feat: add --gpx flag for travel route overlay#224
Open
tmchow wants to merge 5 commits intooriginalankur:mainfrom
Open
feat: add --gpx flag for travel route overlay#224tmchow wants to merge 5 commits intooriginalankur:mainfrom
tmchow wants to merge 5 commits intooriginalankur:mainfrom
Conversation
Parse GPX files with stdlib xml.etree.ElementTree and render the GPS track as a colored line on the map poster. The route is drawn after roads but before gradient fades, using pyproj (already installed via osmnx) for coordinate transformation. Route color defaults to the theme's road_motorway color. Themes can override it with an optional route_color field.
Default route color changed from road_motorway (blends in) to #E74C3C (bright red). Line width increased from 3.0 to 5.0 scale units. zorder raised to 8 so the route draws above roads and water.
Route color now falls back to the theme's text color instead of a hardcoded red. The text color is always chosen by each theme to contrast with its background, so the route is visible on both light and dark themes. Themes can still override with route_color.
Each theme gets a deliberately chosen route accent color that contrasts with both the background and road network. Warm themes get cool complements (teal, plum), cool themes get warm accents (orange, coral). The route_color field is optional for custom themes and falls back to the text color.
|
that image looks so pretty |
Author
Ha, thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
--gpxflag that accepts a GPX file path and renders the GPS track as a colored line overlay on the poster. Uses stdlibxml.etree.ElementTreefor parsing andpyproj(already installed via osmnx) for coordinate transformation.Why this matters
The JS variant (dimartarmizi/map-to-poster) has travel path plotting built in. Paid services like MixPlaces sell route map posters as a core product. The Python CLI had no route visualization.
GPX is the standard format exported by Strava, Garmin, Apple Watch, and every GPS app, so this covers the most common use case for commemorating a hike, run, or bike ride on a poster.
Changes
parse_gpx(gpx_path)(new function): parses GPX files using stdlib XML, extracts<trkpt>lat/lon pairs. Handles the GPX 1.1 namespace. Returns empty list with error message on malformed files.--gpxCLI argument: optional path to a GPX filecreate_poster(): transforms lat/lon to the projected CRS via pyproj, draws the route withax.plot()between the road layer and gradient fades (zorder 8). Line width scales with poster dimensions.route_colortheme field (new, optional): each of the 17 built-in themes gets a hand-picked accent color chosen to contrast with both the background and road network. Warm themes get cool complements (teal, plum), cool themes get warm accents (orange, coral). Custom themes fall back to the text color.route_coloras an optional theme fieldUsage
All themes with route overlay
Testing
python -m compileall)This contribution was developed with AI assistance (Codex).