Repository navigation
feat(deck.gl-geotiff)!: take MosaicLayer's items as data, and pass their sources as source - #804
Merged
Merged
Conversation
MosaicSource becomes MosaicItem, so that "source" can mean the source opened for an item. The tileset's spatial index and the layer's state call them items too, and the tileset's doc no longer claims it rebuilds the index itself. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eir sources as source
MosaicLayer's items move from `sources` to deck.gl's `data` prop, so they
can be an array, a promise, or a URL with `dataTransform`, such as a STAC
search. The layer rebuilds its index whenever deck.gl reports `dataChanged`.
Its callbacks get the source `getSource` opened for an item as `source`:
`renderSource(item, { source, signal })`, `onSourceLoad(item, { source })`
and `onSourceUnload(item, { source })`. `onViewportLoad`'s entries become
`{ item, source }`. The type parameters become `ItemT` and `SourceT`.
naip-mosaic moves to the new props.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The spec records three decisions: - MosaicLayer's items are `data` (decision 15). - naip-mosaic keeps its own source cache, and why (decision 16). - The `maxCacheByteSize` bug (#803, decision 17). naip-mosaic's comments explain its cache, and dev-docs/world-copies.md calls mosaic items "items". Co-Authored-By: Claude Opus 5.5 <[email protected]>
The test rendered plain newer data right after the older promise resolved, before deck.gl could apply it, so it passed even without deck.gl's latest-wins guard. It now lets the older promise land, then renders the same newer data again. Without the guard, that render fetches the older items, and the test fails. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Items need a unique id unless the list only grows: with the default positional id, a new item at a cached position draws as the old one. The docs said shifted items re-fetch. - getSource's signal aborts when deck.gl cancels the open (the layer is removed, or too many opens are in flight for items out of view), not whenever an item leaves view. The spec said the same. - Changing the data array in place isn't supported, and dataComparator can't see such a change. - The dataTransform examples now compile. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kylebarron
commented
Oct 26, 2026
Member
Author
There was a problem hiding this comment.
the changes in this file are all just renames 👍
kylebarron
added a commit
that referenced
this pull request
Oct 30, 2026
> [!NOTE] > This PR was written by Claude (Claude Code), not by @kylebarron. Bumps `version` to `0.10.0-beta.1` in the root `package.json` and in every `packages/*/package.json`, ready for the first 0.10 beta. The publish workflow sees `beta` in the version and publishes to npm under the `beta` dist-tag, so `latest` stays on 0.9.0. `CHANGELOG.md` gets a `v0.10.0-beta.1` section listing the 19 PRs merged since v0.9.0. ## Publish `@developmentseed/range-reader` by hand before tagging `@developmentseed/range-reader` (#806) isn't on npm yet, and `@developmentseed/geotiff` and `@developmentseed/deck.gl-geotiff` depend on it. The publish workflow can't create it: it publishes only through trusted publishing (OIDC), and npm can add a trusted publisher only to a package that [already exists](https://docs.npmjs.com/cli/v11/commands/npm-trust). Pushing the tag first would fail at `range-reader`. `pnpm publish --recursive` stops at the first failure, so packages published before it in the run would be out, and the rest, including `geotiff` and `deck.gl-geotiff`, would not. Once this is merged, from an up-to-date `main`: 1. Publish it once, as a public package under the `beta` tag. Its `prepublishOnly` script builds it first. ```sh cd packages/range-reader pnpm publish --tag beta --access public --no-git-checks ``` 2. Give it the same trusted publisher as the other packages (workflow `release.yml`, environment `release`), in its settings on npmjs.com or with: ```sh npm trust github @developmentseed/range-reader --file release.yml --repo developmentseed/deck.gl-raster --env release --allow-publish ``` 3. Tag the merge commit `v0.10.0-beta.1` and push the tag. The workflow skips `range-reader`, since that version is already on npm, and publishes the other ten packages. ## Breaking changes - #799: `COGLayer` takes a single `source`: an opened `COGSource`, or any input of `COGSource.open`. `geotiff` becomes `source`, `onGeoTIFFLoad` becomes `onSourceLoad`, and `epsgResolver` and `concurrencyLimiter` move to `COGSource.open`. - #801: `MultiCOGLayer` does the same with `MultiCOGSource`. `sources: { red: { url } }` becomes `source: { red: url }`, `MultiCOGSourceConfig` is removed, and files that don't share a CRS and an extent are rejected. - #804: `MosaicLayer`'s `sources` becomes deck.gl's `data`, and `MosaicSource` becomes `MosaicItem`. The callbacks get the item's opened source as `source`, and `onViewportLoad`'s entries are `{ item, source }`. - #821: `renderSource` gets only `{ source }`, without `signal`. - #812: `ZarrLayer` takes a `ZarrSource`, or a zarrita group or array, as `source`. `node`, `variable`, `metadata` and `epsgResolver` are removed (`metadata` becomes `ZarrSource.open`'s `geoZarrMetadata`), and the type parameters are now `ZarrLayer<DataT, Dtype, Store>`. - #807: `GeoTIFF.fromUrl` no longer takes `chunkSize` or `cacheSize`. They're `RangeReader` options now (`minMetadataReadBytes`, `cache.metadataBytes`). Two behavior changes aren't marked breaking: - #809: COG tile reads are coalesced by default, and `COGLayer` and `MultiCOGLayer` default to `maxRequests: 256` and `debounceTime: 50`. - #818: changing `updateTriggers.getTileData`, or ZarrLayer's `selection`, fetches tiles again, and the old tiles are removed at once. 🤖 Written by [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Note
This PR was written by Claude (Claude Code), not by @kylebarron.
Stage 3 of the Sources design,
dev-docs/specs/2026-10-22-sources-design.md: MosaicLayer takes its items as deck.gl'sdata, and passes each item's opened source to its callbacks assource. In MosaicLayer, a "source" now always means an opened source, such as aCOGSource, and an "item" means an entry of the mosaic (question 7).data.datacan be an array, a promise, or a URL that deck.gl loads, so a STAC search needs no fetch code of its own.dataTransform,dataComparatorandonDataLoadwork as in other deck.gl layers, andisLoadedwaits fordatato load.dataChanged.source:renderSource(item, { source, signal });onSourceLoad(item, { source })andonSourceUnload(item, { source });onViewportLoad's entries are{ item, source }.MosaicSourceis nowMosaicItem, and the type parameters areItemTandSourceT.SourceTstays unconstrained, so a mosaic of plain images, such as one drawn withBitmapLayer, still works.getSourceopening aCOGSource.getSource'sconcurrencyLimiterpoints toCOGSource.open.idunless the list only grows by appending. With the default id, its position, a new item at a cached position draws as the old one, as on main. The old docs said such items re-fetch.getSource's signal: when the layer is removed, or, for an item out of view, when more thanmaxRequestsopens are in flight. It doesn't abort as soon as the item leaves view.Example caches
naip-mosaic is the only example that uses MosaicLayer, and it moves to the new props.
It keeps its own cache of opened sources, with MosaicLayer's cache turned off (
maxCacheSize: 0), because MosaicLayer's cache would hold much more than sources:So each cached item would hold its COGLayer and its GPU textures, not just its source. A later PR can make MosaicLayer keep only sources (the spec's option B).
While looking into this, I found that
maxCacheByteSizeleaves MosaicLayer's cache unbounded, filed as #803.vermont-cog-comparison's cache stays too: it's the app keeping the sources it switches between.
The spec records these decisions as 15 to 17.
Migration
MosaicLayer'ssourcesbecomesdata, andMosaicSourcebecomesMosaicItem.The callbacks'
datafield becomessource.onViewportLoad's entries change from{ source, data }to{ item, source }, soentry.sourcenow holds the opened source, where it used to hold the item:TypeScript catches most of this, but not all of it:
sourcesandMosaicSourceare rejected.entry.sourceas the item. WithSourceTleft at its defaultany, as innew MosaicLayer<MyItem>(...),entry.source.bboxstill compiles and isundefinedat runtime. Check everyonViewportLoad,onSourceLoadandonSourceUnload.sourcesand the callbacks'{ data }are ignored without a warning. The mosaic draws nothing, anddatareads asundefined.Tests
data:dataTransform. In the URL test, the layer'sfetchprop stands in for the network.datadoesn't replace it, even when the app then renders that newerdataagain. Without deck.gl's latest-wins guard, this test fails.data: nulldraws nothing, without an error.renderSourceandonSourceLoadget each item's opened source.onViewportLoadreports each item with its source.onSourceUnloadgets an evicted item's source.data.data, thesourcethatrenderSourceandonViewportLoadget, and the removedsources.sourcefromrenderSource,onViewportLoadoronSourceUnload.🤖 Written by Claude Code