Skip to content

fix: Respect minZoom / visibleMin/MaxZoom in RasterTileset2D - #465

Merged
kylebarron merged 1 commit into
mainfrom
kyle/fix-zoom-gates
Apr 24, 2026
Merged

kylebarron merged 1 commit into
mainfrom
kyle/fix-zoom-gates

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Summary

  • RasterTileset2D.getTileIndices (our Tileset2D subclass that drives LOD from a TilesetDescriptor) ignored the four viewport-zoom gates — minZoom, maxZoom, visibleMinZoom, visibleMaxZoom — so any consumer that set them (e.g. ZarrLayer, COGLayer) saw tiles keep fetching at viewport zooms where they'd never be drawn. Added an explicit viewport-zoom check that mirrors upstream's default Tileset2D behavior: return [] when viewport.zoom is outside those bounds.
  • With the fix, minZoom > visibleMinZoom now behaves as advertised: fetching stops below minZoom, but already-cached tiles keep rendering down to visibleMinZoom thanks to cache retention in tileset.tiles. This is the smooth zoom-out pattern that was previously impossible on descriptor-driven layers.
  • Added dev-docs/zoom-terminology.md. The conflation of two different "zoom" concepts (tileset z-index into descriptor.levels vs continuous viewport.zoom) is the root cause of this bug class. The doc pins each concept to a name, covers how deck.gl 9.3's four zoom props relate to each, and walks through a concrete example (the aef-mosaic example) end-to-end.

Test plan

  • Existing 62 deck.gl-raster tests still pass.
  • Typecheck clean.
  • CI green.
  • Manual: examples/dynamical-zarr-ecmwf + examples/zarr-sentinel2-tci still render.
  • Manual: set minZoom: 12, visibleMinZoom: 11 on a ZarrLayer over a global single-level zarr; verify tile fetches stop at viewport zoom < 12 but cached tiles stay visible down to zoom 11.

🤖 Generated with Claude Code

RasterTileset2D overrides Tileset2D.getTileIndices to drive LOD from a
TilesetDescriptor, but the override ignored the four viewport-zoom gates
(minZoom, maxZoom, visibleMinZoom, visibleMaxZoom). So a caller that
set minZoom=12 on a ZarrLayer or COGLayer would keep fetching tiles at
viewport zoom 11, 10, 9 … — exactly the runaway cost those props are
meant to prevent.

Add an explicit viewport.zoom check at the top of our getTileIndices
that mirrors deck.gl's default Tileset2D: return [] when viewport.zoom
is below minZoom / visibleMinZoom or above visibleMaxZoom. Cache
retention + TileLayer.renderLayers() still draw already-fetched tiles
within the visible band, so setting minZoom > visibleMinZoom keeps
smooth zoom-out behavior.

Add dev-docs/zoom-terminology.md: "zoom" in this codebase refers to two
distinct concepts (tileset z-index into descriptor.levels vs the
continuous viewport.zoom), and conflating them is the root cause of
this bug class. The doc pins each concept to a name and spells out how
upstream deck.gl's four zoom props behave for our descriptor-driven
tileset.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@github-actions github-actions Bot added the fix label Apr 24, 2026
@kylebarron
kylebarron merged commit 94f81b6 into main Apr 24, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/fix-zoom-gates branch April 24, 2026 15:24
@ds-release-bot ds-release-bot Bot mentioned this pull request Apr 24, 2026
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