Skip to content

Add static map integration for timeline using maps.jetzt API#1182

Open
maltehuebner wants to merge 5 commits intomainfrom
feature/static-maps-timeline-clean
Open

Add static map integration for timeline using maps.jetzt API#1182
maltehuebner wants to merge 5 commits intomainfrom
feature/static-maps-timeline-clean

Conversation

@maltehuebner
Copy link
Copy Markdown
Contributor

Summary

  • Introduces StaticMapService to generate static PNG map images via the maps.jetzt API
  • Replaces interactive Leaflet.js maps in timeline items with static images for better performance
  • Provides automatic fallback to Leaflet maps if the API is unavailable

Changes

New files:

  • src/Criticalmass/StaticMap/StaticMapService.php - Service for API communication
  • src/Criticalmass/StaticMap/Cache/StaticMapCache.php - 7-day URL caching
  • src/Twig/Extension/StaticMapTwigExtension.php - Twig functions for templates

Updated templates:

  • rideTrack.html.twig - Polyline maps for uploaded tracks
  • rideEdit.html.twig - Marker maps for edited rides
  • cityEdit.html.twig - Marker maps for edited cities
  • cityCreated.html.twig - Marker maps for new cities

Configuration:

  • Added MAPS_JETZT_API_URL environment variable
  • Added service bindings in services.yaml

Test plan

  • Open timeline and verify static map images load
  • Set MAPS_JETZT_API_URL to invalid URL and verify Leaflet fallback works
  • Check browser DevTools for <img> tags instead of <div data-controller="map--map">
  • Verify cached URLs are reused on subsequent page loads

🤖 Generated with Claude Code

maltehuebner and others added 5 commits February 5, 2026 13:42
Introduces a service to generate static map images via the maps.jetzt API,
supporting both polyline maps (for tracks) and marker maps (for rides/cities).
The cache stores URLs for 7 days to minimize API calls.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds MAPS_JETZT_API_URL to .env.dist and binds it to services via services.yaml.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Provides static_map_polyline() and static_map_marker() Twig functions
to render static map images in templates.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates rideTrack, rideEdit, cityEdit, and cityCreated templates to use
static map images from maps.jetzt API. Falls back to Leaflet.js maps if
the API is unavailable.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant