Repository navigation
feat: animated raster layers (GeoTIFF frame stacks + video overlays), play/pause only - #23
Merged
Merged
Conversation
…pause only
Two generic layer types for animations, deliberately without a timeline or
shared clock: viewers get play/pause, and play state stays in each viewer.
- add_geotiff_frames: 2..240 single-band GeoTIFFs rendered through the
existing singleband path with one fixed vmin/vmax (required), concurrently
(4 at a time). Every frame must land on frame 1's grid, else the request
fails naming the frame and leaves nothing behind. Frames are stored as
{asset_id}-{i}.png, frame 0 also as {asset_id}.png. fps clamped to
0.25..30; optional per-frame labels shown beside the play button.
- add_video: 1..3 WebM/MP4 encodings, downloaded with a size cap
([video] max_file_size_mb, default 100), sniffed by magic bytes, stored
as {asset_id}-{i}.webm|.mp4, optional PNG/JPEG poster as {asset_id}.png.
Bounds may cross the antimeridian (east > 180, kept as given).
- Both store a server-owned assets.animation JSON (served URLs, fps, labels,
loop, autoplay, bounds), returned by GET /assets and the session snapshot,
so reloads rebuild them. asset_type geotiff_frames / geotiff_video, so
they stack and read as rasters.
- Viewer: frames preload as blob URLs and advance with updateImage; video
uses MapLibre's video source (boxes centred past 180 drawn on the western
world copy, which MapLibre requires). Compact bottom-left play/pause rows;
hidden with the layer, removed on delete, timers paused while the page is
hidden. ?animate=0 (and the headless screenshot service) holds every
animation on its first frame, so screenshots are stable. WS screenshots
no longer wait for an 'idle' that never fires while a video plays.
- Files route serves video/webm and video/mp4 with Range support.
- SDK add_geotiff_frames / add_video; MCP add_animation tool; docs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Adds two animated raster layer types: a frame stack (one GeoTIFF per frame, played at a fixed frame rate) and a video overlay (a pre-encoded WebM/MP4 placed by its corners with MapLibre's
videosource). Both have play/pause only: no timeline, no scrubbing, and no shared map clock.Events
add_geotiff_framesurls(2–240 GeoTIFFs),colormap, and a required fixedvmin/vmax.fps(clamped to 0.25–30),labels(one per frame),loop,autoplay,nodata,alpha,band.geotiff_frames. Frame 0 is also written as{id}.png, so thumbnails and existing raster handling keep working.add_videourls(1–3, in browser preference order, e.g. WebM with alpha, then MP4),boundsin EPSG:4326, optionalposter_url,loop,autoplay,alpha.[video] max_file_size_mb, default 100). The container type is checked from magic bytes, and only WebM/Matroska and MP4 are accepted.eastmay exceed 180 for overlays crossing the antimeridian. MapLibre rejects an image/video box whose centre is past 180°, so the client draws such boxes shifted by −360°, which is the same place on the globe.geotiff_video.Both events are in
Z_EVENTSand appear in the contract'sCHANGE_EVENTS.source_urlkeeps its query string.Persistence and client
assets.animationJSON column (additive migration), returned onGET /assetsand in the session snapshot. Restore handles both types before the genericgeotiff_branch.updateImage.videosource.i/N · labelfor frame stacks.ui=none. That's accepted for now, butui=nonewas meant to show no UI at all, so this should be revisited with the other chrome that has crept into that mode.?animate=0holds frame 0 with no control. The screenshot service uses it and waits for the animations to be ready.video/webmandvideo/mp4. Range requests return 206, which Safari needs.SDK and MCP
MapSession.add_geotiff_frames(...)andMapSession.add_video(...)._send_eventtakes an optionaltimeout: 60 s or more for frames, 300 s for video.add_animation(kind="frames" | "video", ...).docs/llm-context.md,docs/mcp-integration.md, puppeteer skills.Testing
tests/test_animation.py: 43 tests covering validation, mismatched grids, cleanup on error, payloads, the snapshot, Range, bounds past 180°, and the MCP tool.tests/test_animation_browser.py: headless Chromium. Frames advance, pause and resume; the VP9-alpha video plays; hide/show and delete; restore after reload;?animate=0; the canvas stays untainted.mainbefore this change (test_mcp_phase0MCP lifespan, andtest_screenshot_loopback, which fails only in a full run).Not covered
setStyleis untested (needs a MapTiler key).map.loaded()oridlewill wait forever while a video plays.?animate=0is the documented workaround.🤖 Generated with Claude Code