Skip to content

refactor: Don't honor visibleMinZoom / visibleMaxZoom - #466

Merged
kylebarron merged 1 commit into
mainfrom
kyle/drop-visible-zoom
Apr 24, 2026
Merged

kylebarron merged 1 commit into
mainfrom
kyle/drop-visible-zoom

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Summary

Revert the visibleMinZoom/visibleMaxZoom branch added by #465. Those props exist on TileLayer for the purpose of decoupling fetch from render when a layer has a dense OSM-style overview stack — upstream sidesteps the "returning [] marks all tiles invisible" coupling by clamping z to minZoom instead of returning []. That mechanism doesn't port to descriptor-driven layers: a single-level zarr has no coarser z to clamp to, and sparse COG pyramids skip many viewport-zoom steps between levels.

Rather than ship two props that behave identically to minZoom/maxZoom (because the coupling kills render when they return [] too), drop them. dev-docs/zoom-terminology.md is updated to explain why and to recommend the plain minZoom/maxZoom pair for descriptor-driven layers.

Test plan

  • pnpm --filter @developmentseed/deck.gl-raster test — 62/62 pass.
  • Typecheck clean.
  • CI green.

🤖 Generated with Claude Code

Deck.gl 9.3's visibleMin/MaxZoom are meant to decouple fetching from
rendering — "stop fetching below minZoom, stop rendering below
visibleMinZoom" — so already-cached tiles keep showing when the user
zooms past the fetch threshold. Upstream leans on OSM-style LOD
clamping to make that work: when underzoomed, the default Tileset2D
clamps the selected z to minZoom and keeps selecting tiles at that
coarser level.

That mechanism doesn't port to descriptor-driven layers. When our
RasterTileset2D.getTileIndices returns [] (for any reason, including a
minZoom gate), deck.gl's updateTileStates marks every cached tile
isVisible = false, and TileLayer.filterSubLayer early-outs on that. So
returning [] kills both fetch and render; there's no gap for
visibleMinZoom to live in. The obvious alternative — clamping z to a
coarser LOD — requires a dense overview stack we don't have (single-
level zarr has no coarser z; sparse COG pyramids skip many viewport-
zoom steps between levels).

Rather than ship props that nominally exist but behave identically to
minZoom/maxZoom, drop the visibleMin/MaxZoom branch from our
getTileIndices. Update dev-docs/zoom-terminology.md to spell out the
reasoning and recommend minZoom/maxZoom alone for descriptor-driven
layers.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@kylebarron
kylebarron merged commit d284aec into main Apr 24, 2026
3 of 4 checks passed
@kylebarron
kylebarron deleted the kyle/drop-visible-zoom branch April 24, 2026 15:46
kylebarron added a commit that referenced this pull request Apr 24, 2026
* docs: Add AEF mosaic example design spec

AlphaEarth Foundations GeoZarr Mosaic example. Uploads 64 bands per tile as
an r8sint Texture2DArray; users pick three bands for an RGB composite and
dequantization happens in-shader. One upstream ZarrLayer change: derive tile
size from the inner sharding codec chunk, not the outer shard.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs: Drop unneeded ZarrLayer change from AEF spec

Verified that [email protected]'s Array.chunks already returns the inner sharding
chunk shape for sharded arrays (hierarchy.js createContext sets chunkShape
from the sharding codec configuration). So the existing
arr.chunks[arr.chunks.length - 1] tile-size derivation is correct for the AEF
store, and the planned upstream change is a no-op.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat: Scaffold aef-mosaic example (empty map)

Vite + React + MapLibre scaffolding for the AlphaEarth Foundations GeoZarr
Mosaic example. No data layer yet — just a dark basemap centered on San
Francisco Bay to confirm the dev server boots.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat: Add AEF constants, selection builder, preset locations

Static data modules for the example: zarr URL + dequantization constants,
buildSelection() for pinning the year, and a list of preset regions for the
location dropdown.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat: Add SampleAefRgb GPU shader module

Combined sample + dequantize + rescale module. Samples three layers of an
r8sint Texture2DArray at user-selected band indices, dequantizes via
(v/127.5)^2 * sign(v) in-shader, linearly rescales each channel to [0, 1],
and discards pixels where any sampled channel is the int8 nodata sentinel
-128.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat: Implement getTileData for AEF tiles

Slices one year × all 64 bands × tile bounds via zarrita, uploads the raw
int8 data to an r8sint Texture2DArray. Checks chunk shape defensively to
catch selection/metadata misalignments early.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat: Add AEF render pipeline builder

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat: Render AEF mosaic with hardcoded state

Opens the embeddings array, passes the root group attrs to ZarrLayer as a
metadata override (the store's top-level spatial:* attrs are already GeoZarr
compliant), and renders bands 0/16/32 as R/G/B for 2025 with a [-0.3, 0.3]
rescale. No UI controls yet — state is hardcoded to establish the rendering
path end-to-end.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat: Add fetchBandLabels helper

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat: Add AEF control panel

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat: Add interactive control panel to aef-mosaic example

Location dropdown (flyTo), year slider (re-keys layer → refetch), three band
dropdowns (uniform-only change), and a shared rescale range slider. Band
labels fetched asynchronously from the `band` zarr coord at mount.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat: Hide AEF layer below zoom 12 (no overviews in source)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test: Guard zarrita sharded-array chunk-shape invariant

The AEF mosaic example relies on zarrita returning the inner sharding
chunk shape via arr.chunks (not the outer 4096x4096 shard). This test
synthesizes a sharded Zarr v3 array and asserts arr.chunks equals the
inner chunk shape, so a future zarrita version that changes this behavior
fails loudly.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* perf: Cull root tiles to viewport before instantiation

The traversal's z=0 loop instantiated every tile in the coarsest level's
matrix upfront, relying on frustum culling downstream to discard the ones
outside the viewport. For traditional OGC pyramids that's fine (z=0 is ~1
tile), but single-level Zarr descriptors can be thousands × thousands of
tiles at their native resolution — the AEF mosaic (4009984 × 1859584 px at
256² tiles) instantiates ~114M RasterTileNodes at startup, effectively
hanging the page.

Cull to the intersection of the dataset extent and the viewport's WGS84
bounds: project the four corners into the source CRS via
`descriptor.projectFrom4326` and consult the root level's existing
crsBoundsToTileRange. Typical viewport → tens of root tiles. If the
viewport and dataset don't overlap, traversal is skipped entirely.

Prototype commit — to be extracted onto its own branch for a standalone
perf: PR once verified end-to-end via the AEF example.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat: Use visibleMinZoom for smoother AEF zoom-out

Replace the app-level viewport-zoom gate with the layer's built-in
minZoom / visibleMinZoom pair (new in deck.gl 9.3). Tiles fetched at
zoom ≥ 12 remain visible down to zoom 11, so zooming out by one level
stays smooth instead of snapping to blank.

Adds `visibleMinZoom` / `visibleMaxZoom` to the RasterTileLayerProps
pass-through so any RasterTileLayer subclass (ZarrLayer, COGLayer) can
expose them.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fixup: Drop visibleMinZoom from AEF example and RasterTileLayer

Matches PR #466 (refactor: Don't honor visibleMinZoom / visibleMaxZoom).
Consolidates FETCH_MIN_ZOOM / VISIBLE_MIN_ZOOM into a single MIN_ZOOM
constant and removes the visibleMin/MaxZoom pass-through from
RasterTileLayerProps (the passthrough never landed on main; it was only
ever in the earlier commit on this branch).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat: Swap AEF year + band UI — dropdown for fetches, sliders for GPU

Better UX mapping between control type and cost:
- Year → dropdown. Changing the year refetches every visible tile
  (new zarr chunks), so discrete commits are right.
- R / G / B band → sliders. Changing bands is a shader uniform change
  with no network — scrubbing should feel instant, and the wider label
  ("Red band: A17") updates live as you drag.

Rescale range was already a slider; location stays a dropdown.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* Add info hover box and reduce min zoom to 10

* improve docstring

* zarr type guard

* remove cast

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant