Skip to content

feat: map viewer at /maps with STAC-backed display metadata#76

Draft
turban wants to merge 27 commits intomainfrom
feat/maps-viewer
Draft

feat: map viewer at /maps with STAC-backed display metadata#76
turban wants to merge 27 commits intomainfrom
feat/maps-viewer

Conversation

@turban
Copy link
Copy Markdown
Contributor

@turban turban commented May 7, 2026

Summary

  • Adds a display block (colormap, range, nodata) to each built-in dataset template YAML
  • Surfaces display metadata through the STAC Render extension on every published STAC collection, alongside climate_api:variable and climate_api:units vendor fields
  • Adds GET /maps — a single-page HTML map viewer that reads the STAC catalog, loads per-dataset render and datacube metadata, and renders data via MapLibre GL + @carbonplan/zarr-layer with a time slider derived from cube:dimensions
  • Adds a Map viewer link to the landing page

How it works

dataset YAML (display block)
  → STAC collection (renders + stac_extensions)
    → /maps viewer (reads catalog.json, loads collection, init ZarrLayer)

The browser reads the Zarr store directly via the existing /zarr/{dataset_id} HTTP range endpoint. No tile server, no build step.

Display defaults

Dataset Colormap Range
CHIRPS precipitation blues 0–20 mm
ERA5 temperature rdbu_r 15–40 °C
ERA5 precipitation blues 0–5 mm/h
WorldPop population viridis 0–1000 people

Test plan

  • Start the API and open http://localhost:8000/maps
  • Verify the dataset dropdown populates from /stac/catalog.json
  • Select a published dataset — map zooms to extent, ZarrLayer renders
  • Move the time slider — layer updates to the correct time step
  • Check that /stac/collections/{id} includes renders and the Render extension URL in stac_extensions
  • Verify a dataset template without a display block produces no renders in the collection

Closes #66

Add a display block to each built-in dataset template (colormap, value
range, nodata) and surface it through the STAC Render extension on every
published collection. Add a /maps endpoint that serves a single-page map
viewer: it reads the STAC catalog to list available datasets, loads the
Render and Datacube metadata to configure a ZarrLayer (MapLibre +
@carbonplan/zarr-layer), and builds a time slider from cube:dimensions.
No tile server or build step required — the browser reads the Zarr store
directly via the existing /zarr HTTP range endpoint.

Closes #66
@turban turban marked this pull request as draft May 7, 2026 22:42
turban added 26 commits May 8, 2026 00:47
Implements issue #72. Adds a server-rendered management page at GET /manage
that lets operators ingest and sync datasets without needing to know API
endpoint details or dataset template IDs.

- GET /manage renders a Jinja2 page with an ingest form (template dropdown,
  start/end dates, extent pre-filled) and a status table with per-dataset
  Sync buttons; flash messages show success or error after each operation
- POST /manage/ingest handles the ingest form and redirects back to /manage
- POST /manage/sync handles the sync form and redirects back to /manage
- Landing page gains an "Available dataset templates" card listing all
  registered templates and a Manage link in the Explore section
Pass opacity: 0.75 to ZarrLayer so the basemap shows through the data
layer. Also wire renders.nodata from the STAC collection into ZarrLayer's
fillValue so dataset-specific nodata pixels render as transparent.
Shows a gradient bar with min/max labels and units when a dataset is
selected. Legend is built from the same colormap and clim range used
by the data layer, sourced from the STAC renders block.
Replaces the OSM raster style with OpenFreeMap's positron vector style.
The data layer is inserted before the first symbol layer so country
borders, road labels, and place names always render on top of the
climate data.
Replaces the OSM raster style with OpenFreeMap's positron vector style.
The data layer is inserted before the first symbol layer so country
borders, road labels, and place names always render on top of the
climate data.
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.

Map viewer at /maps with STAC-backed display metadata

1 participant