Repository navigation
feat(deck.gl-geotiff)!: open the files of one scene with MultiCOGSource - #801
Conversation
Resolving a GeoTIFF's CRS and building its projection functions move into `projection.ts`, for MultiCOGSource to share. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…one scene
`MultiCOGSource.open({ red: url, nir: url })` opens the files of one
scene in parallel and rejects files that don't make one scene (#723):
they must share a CRS, and every edge must be within one pixel of the
coarser file. It resolves the CRS once and groups the files' tile grids,
with the finest file as primary. A file that fails to open is named in
the error.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
MultiCOGLayer's `source` takes an opened MultiCOGSource, or a record of
COGs for the layer to open with `MultiCOGSource.open`. It replaces
`sources` and its `{ url }` wrapper (`MultiCOGSourceConfig`).
`epsgResolver` and `concurrencyLimiter` move to `MultiCOGSource.open`,
and `onSourceLoad(source)` replaces `onGeoTIFFLoad`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
`MultiCOGSource` is a class of its own (question 8). The spec states the scene checks as built, sketches MultiCOGSource, and records MultiCOGLayer's single `source` prop and its removed props. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ed mid-read chunkd's HTTP source wraps every failed fetch, aborts included, in a `SourceError` named "Error", so aborting `COGSource.open` or `MultiCOGSource.open` during a header read rejected with "Failed to fetch" instead of an AbortError. `fetchGeoTIFF` now throws the signal's abort reason instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| // An opened source needs no loading | ||
| return ( | ||
| props.source !== oldProps.source && | ||
| !(props.source instanceof MultiCOGSource) | ||
| ); |
There was a problem hiding this comment.
I wonder if perhaps we could somehow get this to work by making source an async prop and overriding how the loading works? It's a little annoying here to have to check if it's an instance of the MultiCOGSource class
There was a problem hiding this comment.
Note
This reply was written by Claude (Claude Code), not by @kylebarron.
I looked at how deck.gl 9.4 loads async props, and I don't think they fit here, for three reasons.
- Nothing gets aborted. deck.gl calls
fetch(url, { propName, layer })without a signal (layer-state.ts), and the newest value wins only through a load counter. A replaced or removed open would keep reading headers and holding limiter slots. Stage 1's_loadMetadataaborts it today. - Only strings and promises are loaded (component-state.ts). Every other value is set as it is, so a record, an
ArrayBufferor aGeoTIFFwould reach the layer unopened, and we'd need the check anyway. An app could passMultiCOGSource.open(record)as a promise, though. - There's no load callback. deck.gl calls
onDataLoadonly fordata, soonSourceLoadwould need its own detection.
The check bothers me too. The cleaner fix is to stop repeating it. When ZarrLayer becomes the third layer with a source (stage 4), RasterTileLayer can own this plumbing once, with two hooks per layer, say isOpenedSource(value) and openSource(input, signal). The instanceof would then be one line per layer. I'd do that in stage 4 rather than here.
🤖 Written by Claude Code
- The package README's quick start passes COGLayer `source`, not the removed `geotiff`. - `DEFAULT_CONCURRENCY_LIMITER` is the default of `COGSource.open`, `MultiCOGSource.open` and MosaicLayer, not of the layers' removed `concurrencyLimiter` prop. - Both layers' `signal` docs say it aborts tile requests, not the open. - MultiCOGLayer's `source` doc says an empty record draws nothing, and `geotiffs` is documented in the record's key order. - The spec's goals, decision 13, `open()` steps and open questions 5 and 6 match 2b as built. Co-Authored-By: Claude Opus 5.5 <[email protected]>
> [!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]>
Note
This PR was written by Claude (Claude Code), not by @kylebarron.
Stage 2b of the Sources design,
dev-docs/specs/2026-10-22-sources-design.md: the files of one scene, such as the band files of one Sentinel-2 image, open as aMultiCOGSource. Files that don't make up one scene are rejected (#723).MultiCOGSource.open(record, options)(deck.gl-geotiff) opens every file in parallel.COGSource.open.geotiffs(by name),projectionandmultiTilesetDescriptor, plusRasterSource'stilesetDescriptorandgeographicBounds, both from the primary.Failed to open "nir" (<url>): <reason>, with the original error as itscause. An abort stays a plainAbortError.MultiCOGLayer's singlesourceprop takes an openedMultiCOGSource, or a record of COGs that the layer opens itself, as COGLayer does since feat(deck.gl-geotiff)!: open COGs with COGSource #799.URLs,ArrayBuffers or openedGeoTIFFs.onSourceLoad(source).COGSource.openandMultiCOGSource.openshare the CRS resolution and projection setup.AbortError. It used to reject with the HTTP source's "Failed to fetch" error.sentinel-2, the only example that uses MultiCOGLayer, moves over. The spec records that
MultiCOGSourceis a class of its own, and the checks as built. Docs that still described the removed props are updated, including the package README's quick start, which #799 missed. Both layers'signaldocs now say it aborts tile requests but not the open.Migration
MultiCOGLayerno longer takessources,epsgResolver,concurrencyLimiteroronGeoTIFFLoad, andMultiCOGSourceConfigis removed. TypeScript rejects them. In JavaScript they're ignored without a warning.sourcesbecomessource, without the{ url }wrapper:onGeoTIFFLoadbecomesonSourceLoad, and its arguments become fields of the source:epsgResolverandconcurrencyLimiterbecome options ofMultiCOGSource.open:Files that don't share a CRS and an extent are now rejected. MultiCOGLayer used to draw them with the first file's CRS.
Tests
MultiCOGSource.open:GeoTIFFandArrayBufferinputs opens.cause.AbortError, tested through the real HTTP source, forCOGSourcetoo.MultiCOGLayer:MultiCOGSource.open, and the load signal is passed to the open.loadingMetadata.source,onSourceLoadand the removed props.AbortError, or the scene check inopen;_abortMetadataLoad, or its handling of an opened source.Closes #723
🤖 Written by Claude Code