Repository navigation
fix: Respect minZoom / visibleMin/MaxZoom in RasterTileset2D - #465
Merged
Merged
Conversation
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]>
2 of 3 tasks
Closed
Merged
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.
Summary
RasterTileset2D.getTileIndices(ourTileset2Dsubclass that drives LOD from aTilesetDescriptor) 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 defaultTileset2Dbehavior: return[]whenviewport.zoomis outside those bounds.minZoom > visibleMinZoomnow behaves as advertised: fetching stops belowminZoom, but already-cached tiles keep rendering down tovisibleMinZoomthanks to cache retention intileset.tiles. This is the smooth zoom-out pattern that was previously impossible on descriptor-driven layers.dev-docs/zoom-terminology.md. The conflation of two different "zoom" concepts (tileset z-index intodescriptor.levelsvs continuousviewport.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
deck.gl-rastertests still pass.examples/dynamical-zarr-ecmwf+examples/zarr-sentinel2-tcistill render.minZoom: 12, visibleMinZoom: 11on aZarrLayerover 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