Skip to content

feat(server): render location preview via Martin static-images API#3277

Merged
CommanderStorm merged 2 commits into
TUM-Dev:mainfrom
CommanderStorm:feat/preview-static-images
Jun 13, 2026
Merged

feat(server): render location preview via Martin static-images API#3277
CommanderStorm merged 2 commits into
TUM-Dev:mainfrom
CommanderStorm:feat/preview-static-images

Conversation

@CommanderStorm

Copy link
Copy Markdown
Member

Replaces the hand-rolled 5×5 XYZ tile download and stitching in /api/locations/{id}/preview with a single request to Martin's static-image endpoint:

GET /style/{id}/static/{lon},{lat},{zoom}[@{bearing},{pitch}]/{w}x{h}.png

What changed

  • The basemap is rendered at exactly the map-area size (the region above the bottom info panel) and centered on the location, so the existing pin and info-panel geometry are preserved unchanged.
  • Building previews are tilted 20°. Buildings render at z16, which is inside the basemap's building-3d extrusion band (minzoom 14.2 → maxzoom 16.5, full height through z16.2), so a slight tilt shows them in relief. Rooms/POIs (z17) have no extrusions, so they keep the flat north-up view.
  • download_map_image.rsstatic_map_image.rs: one HTTP request per preview instead of up to 9 tile fetches; retries transient 5xx (static rendering has no concurrency support) and bails on 4xx.
  • The static-image endpoint only ships in Martin's main image, so map/martin/Dockerfile now bases on ghcr.io/maplibre/martin:main.

Verification

cargo build, cargo clippy --all-targets, and the URL unit tests pass. Net −215 lines.

⚠️ The tilt's visual result (in particular whether the pin overlaps the near facade) still wants an eyeball against a deployed Martin once this is up.

🤖 Generated with Claude Code

Replace the hand-rolled 5×5 XYZ tile download and stitching with a single
request to Martin's static-image endpoint
(`/style/{id}/static/{lon},{lat},{zoom}[@{bearing},{pitch}]/{w}x{h}.png`).

The basemap is rendered at exactly the map-area size (above the bottom info
panel) and centered on the location, so the pin and panel geometry are
preserved. Building previews render at z16, where the basemap still has 3D
extrusions, so they are tilted 20° to show those buildings in relief; closer
zooms (rooms/pois) keep the flat north-up view.

The static-image endpoint is only in Martin's `main` image, so bump the
basemap Dockerfile base accordingly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 13, 2026 18:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CommanderStorm CommanderStorm enabled auto-merge (squash) June 13, 2026 18:24
@CommanderStorm CommanderStorm merged commit de824a2 into TUM-Dev:main Jun 13, 2026
36 of 38 checks passed
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.

2 participants