Repository navigation
Unify the deck.gl zoom floor and coalesce time-driven reloads - #420
Open
CarsonDavis wants to merge 6 commits into
Open
CarsonDavis wants to merge 6 commits into
CarsonDavis wants to merge 6 commits into
Conversation
A tile layer's configured boundingBox reached Leaflet as `bounds` and was dropped on the deck.gl path, so deck.gl requested tiles across the whole viewport for layers covering one scene. The tile service answered each of those with an uncacheable "tile is outside bounds" 404 - 545 of them in a five-minute session on the disasters dashboard. The box now travels to deck.gl's TileLayer as `extent`, which is the same [west, south, east, north] order mission configuration writes, so it needs no conversion. Parsing moves into a shared parseBoundingBox that makeTileLayer reads once for both engines: a box that does not parse whole is refused whole, because a half-NaN extent clamps every viewport to NaN and the layer would draw nothing - and Leaflet, which used to throw on such a box, now ignores it. deck.gl treats an extent as licence to keep requesting below minZoom: it clamps to minZoom and fetches the whole footprint's worth of tiles where, without one, it hides the layer. visibleMinZoom keeps the layer hidden there, which is also what Leaflet does, so no configuration requests more than it did before.
Every committed time change reloaded every time-enabled layer, and each reload evicts that layer's whole deck.gl tileset and refetches the viewport. Play mode commits as often as every 100ms and a datepicker commits per keystroke, so the commits outran the tiles: 40% of the tile requests in a five-minute session on the disasters dashboard were abandoned before the response, each one already being answered by the tile service. Two limits, both on the reload rather than on the commit - the clock, the labels and the time:changed broadcast still move on every commit: - The reload of the time-enabled layers now runs once per 200ms window, trailing: the first commit books it, later commits fall into the same booking, and it reads the layers' times when it fires. A burst reloads once on the time it ended on, and continuous playback still reloads every window because a commit never pushes the booking back. Only the commit path waits; TimeControl.reloadTimeLayers stays immediate for the plugins and tools that call it directly. - A deck tile layer whose compiled URL is unchanged is left alone instead of being cloned, so a time step inside the layer's current time bucket costs nothing. An explicitly forced refresh still reloads. The deck tile refresher moves out of makeTileLayer into its own module, alongside the COG one, so the URL comparison can be tested directly. The copy of it the engine refresh spec carried goes with that; its cases are covered against the real one.
…resh guard Bounding boxes are parsed once: corners ordered per axis, refused outside +-180/+-90, and accepted as a comma-separated string. One helper in Map_ parses and warns for tile, vectortile and data layers, and one helper builds the Leaflet bounds the four Leaflet call sites share. Vector tile layers now receive the footprint as extent on deck.gl and bounds on Leaflet. deck.gl no longer receives minZoom; visibleMinZoom is the single floor for every tile layer, with or without an extent, derived from the tile size the layer is actually built with. maxZoom falls back to the first finite of maxNativeZoom and maxZoom. The identical-URL guard and the force flag are gone from the refresh path: deck's TileLayer compares data URLs by value, and a requery arrives as a nocache param in the URL. WMS layers get their own refresher that rebuilds the image source and keeps the instance when the compiled URL is unchanged. A timeline commit updates layer times and labels immediately and leaves the Leaflet tile options to the reload it books; the public updateLayersTime still writes them. Configure's populate button reads /cog/info.geojson, whose bbox is in degrees on the pinned TiTiler, through the API base, writes only the fields the response carries, filters projected extents on both the COG and XML branches, and reports what it populated.
…floor against deck.gl A committed time change reloads immediately when no window is open and coalesces the commits inside a window into one trailing reload, so an isolated setTime() no longer waits 200 ms. Configure's Populate Fields reads TiTiler's per-TMS tilejson, which reports zooms and degree bounds together. The deck.gl zoom floor is tested by driving deck's own tileset at and just below the floor.
The admin-typed boundingBox is not a trustworthy footprint, so deck.gl tile and vector tile layers request tiles without one and Leaflet vector tile layers are not clipped to it. parseBoundingBox keeps guarding the Leaflet raster and data layer bounds, video placement, and zoom-to-layer.
21 tasks
CarsonDavis
marked this pull request as ready for review
September 14, 2026 16:20
This was referenced Sep 14, 2026
This branch has not been deployed
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.
Line breakdown
This cuts the redundant tile requests time-driven layers make: time-change reloads throttle to one per 200 ms window, forced refetches travel as URL changes, deck.gl layers get the zoom floor and ceiling their configuration declares, and Configure's Populate Fields button reads TiTiler's tilejson.
What this does
Time changes
TimeControl.reloadTimeLayers()runs at once, drops a booking it satisfies, and opens a fresh window so commits behind it are throttled against it.TimeControl.init()cancels any booked reload, so the previous mission's last time change cannot land on the new mission's layers.updateLayersTime()synchronizes layer times, the labels that read them, and a Leaflet raster layer's tile options, and returns the names of the layers it updated.Refresh
urlandtileOptions—RefreshContextcarries only those two, and the Leaflet adapter always callslayer.refresh(url, false, tileOptions), so a tile whose URL is unchanged stays in cache on both engines.nocacheparamTimeControl.performTimeUrlReplacementsappends to the URL, and both engines reload on it.src/essence/Basics/Layers_/deckTileRefresher.js, both declining to refresh when the source URL is null or compiles to empty, so the engine keeps the layer it holds.deck.gl zoom floor and ceiling
minZoomhides the layer and stops its requests at the same view zoom Leaflet shows the same layer, by turning the Leaflet tile level into deck.gl'svisibleMinZoom(minZoom − log2(512 / tileSize) − 0.5), sominZoom: 5appears at view zoom 3.5 for 256 px raster tiles and 4.5 for 512 px vector tiles.maxNativeZoom(falling back tomaxZoom), deck.gl scales the service's deepest level instead of requesting levels the service does not have.nativeOptions.tileSizeoutranks the layer's owntileSize.Bounding boxes
parseBoundingBoxis the only reader of a layer config'sboundingBox, and it accepts four numbers, four strings, or one comma-separated string, orders transposed corners the way Leaflet'slatLngBoundsdoes, and returns[west, south, east, north]degrees.L.latLng, which throws on a NaN and takes the layer's load down with it.bounds, video placement, and thelayers:getBoundsfallback that zoom-to-layer uses.Configure: Populate Fields
titiler/cog/{tileMatrixSet}/tilejson.json(defaultWebMercatorQuad, the same rule tile requests use) reportsminzoom,maxzoomand lng/latboundsin one call, fetched through the configured API base so it works under a subpath.raster-profiletilemapresource.xml, is refused rather than saved.Decisions to review
Degrees-only footprints are a load-time contract on config data.
parseBoundingBoxis the one reader ofboundingBox, and what it guards is Leaflet raster and data layerbounds, video placement, and zoom-to-layer. A refused box costs a tile or data layer a console warning and an unbounded load; a video layer with a projected box is skipped rather than placed at corners that are not lng/lat degrees. Antimeridian boxes are unrepresentable, as they are in Leaflet. Nothing upstream enforces the rule — server-sidevalidate.jsand Configure's validators range-check nothing — so a projected box saved by hand or copied in byauxiliary/bulk_tilespasses validation and is refused at load.A fixed 200 ms leading-and-trailing throttle on every committed time change, API included. An isolated
setTime()reloads immediately; a second call inside the window defers its reload by up to 200 ms. One constant serves both the 100 ms play loop and any tile service, fast or slow, and the window is global rather than per-layer.reloadTimeLayers()is public API and opens a window of its own, so an external caller polling it holds UI-driven time changes to one reload per window.forceis not in the refresh contract. A forced requery is expressed as a URL change, thenocacheparamperformTimeUrlReplacementsappends. That leaves one channel: anything that keeps the param off the compiled tile URL — a signed URL, a service that rejects unknown params — turns forced requery into a silent no-op.The deck.gl zoom floor is arithmetic over deck internals.
visibleMinZoom = minZoom − log2(512 / tileSize) − 0.5hardcodes deck's 512 px world size and its half-up tile-level rounding, because deck's ownminZoombehaves differently depending on whether the layer has an extent. The test that pins it drives deck's real_Tileset2D.getTileIndicesat the floor and just below it, so a deck upgrade that moves either constant fails the suite, at the cost of importing a_-prefixed export.WMS refresh dedupe rides on a custom prop stored inside the deck.gl layer.
WMSImageSourceis a new object per build and deck.gl comparesdataby identity, so the layer carrieswmsSourceUrl— the URL its source was built from — and the refresher reads it back to skip a no-op clone. The alternative is a module-level map keyed by layer id, keeping the state out of a third-party object. As written it assumeslayer.clone()keeps carrying unrecognized props, which a test pins but deck.gl does not promise.Configure populates from the per-TMS tilejson and writes partial results.
titiler/cog/{tileMatrixSet}/tilejson.jsongives zooms and degree bounds in one call, numbered in the same pyramid the layer's own tile requests use, and requires the deployed TiTiler to expose it. It also depends ontileMatrixSetbeing right before the button is pressed, and that field exists only on the tile layer form — data and image layers always populate asWebMercatorQuad. Fields the source did not report are left unchanged and named in a warning, so the button can leave a layer half-configured and call it a warning rather than a failure.The degrees rule exists twice.
lngLatBoundingBoxinconfigure/restatesparseBoundingBoxbecauseconfigure/cannot import fromsrc/. It saves strings in written order while the runtime orders corners at load, so the two agree only by that convention, and the writer and the reader of the same field can drift.Part of #522