Repository navigation
refactor: Create RasterTileLayer abstraction in deck.gl-raster package - #462
Merged
Merged
Conversation
Factors out the shared tile-layer wiring currently duplicated in COGLayer, ZarrLayer, and Lonboard into a new RasterTileLayer in @developmentseed/deck.gl-raster. Usable directly (Lonboard) or as a subclass (COGLayer/ZarrLayer) via the MVTLayer-extends-TileLayer pattern. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Extends TilesetLevel with tileTransform(col, row) returning forward and inverse pixel↔CRS callbacks. Extends TilesetDescriptor with projectFrom4326 and projectFrom3857. Updates TileMatrixSetAdaptor and geoZarrToDescriptor to populate them, and drops the redundant third-argument projection bundle from RasterTileset2D's constructor (it now reads projectTo4326 from the descriptor). No consumer-facing behavior change. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Addresses code review feedback on commit 130133a: - TileMatrixAdaptor.tileTransform now reuses @developmentseed/affine's invert/apply instead of open-coding a 2x2 inversion, matching the ZarrTilesetLevel implementation. - geoZarrToDescriptor takes a named options object (was 6 positional args). - Remove redundant RasterTileset2D.projectTo4326 private field; read from the descriptor directly. - Add JSDoc on the new tileTransform method implementations.
Introduces RasterTileLayer — a CompositeLayer that wraps @deck.gl/geo-layers TileLayer with the shared wiring for rendering a tiled raster source backed by a TilesetDescriptor. Directly usable with tilesetDescriptor / getTileData / renderTile props, or subclassable by overriding the three protected accessor methods. No consumers migrated yet. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…vel lookup
- Merge types.ts into raster-tile-layer.ts to match deck.gl convention of
"props type then layer class" in the same file.
- Guard _renderSubLayers against out-of-range tile zoom levels instead of
asserting descriptor.levels[z] is defined.
- Drop redundant `| undefined` from accessor return types — the prop types
already express optionality.
- Remove empty initializeState override; CompositeLayer initializes state
to {} by default.
Addresses post-commit review of d08d237.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
COGLayer now inherits its tile-layer wiring from RasterTileLayer. The class body shrinks to GeoTIFF parsing, default-pipeline inference, and three protected accessor overrides that adapt the COG-specific `getTileData(image, options)` signature into RasterTileLayer's tile-centric signature. No public API change. Also widens `RasterTileLayer.defaultProps` type annotation from `Partial<RasterTileLayerProps>` to the canonical deck.gl `DefaultProps<RasterTileLayerProps>` so static-side inheritance works for subclasses. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Re-export MinimalDataT from @developmentseed/deck.gl-raster instead of locally redeclaring it; simplifies the class generic back to the plan's specified form. - Restore the TODO comment about micro-optimizing overview selection that was dropped in the e826ae8 refactor. - Drop the dead-code `options.device ?? this.context.device` fallback — RasterTileLayer._wrapGetTileData always populates options.device. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ZarrLayer now inherits its tile-layer wiring from RasterTileLayer. The class body shrinks to Zarr store parsing, CRS resolution, and the three protected accessor overrides. No default renderTile is provided (GeoZarr lacks metadata hints), matching prior behavior — users still supply their own getTileData and renderTile. The existing public API (selection, metadata, user-supplied getTileData/renderTile) is preserved. No behavior change for consumers. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
… up barrel - RasterTileLayer now forwards `updateTriggers.renderTile` as `updateTriggers.renderSubLayers` on the inner TileLayer, preserving the pre-migration ZarrLayer behavior where users invalidate cached tile rendering by bumping render-side dependencies. COGLayer and direct consumers benefit as well. - Re-export `SliceInput` from @developmentseed/deck.gl-zarr's barrel; in-file export alone left the type unreachable from outside. - Tighten the ZarrLayer `_getGetTileData` closure-capture comment to accurately describe the cache-invalidation semantics. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ection
When a subclass passes COGLayerProps/ZarrLayerProps as ExtraProps (which
redeclares getTileData/renderTile with a domain-specific signature),
the previous class signature `Required<RasterTileLayerProps<DataT>> &
ExtraProps` intersected the base and subclass function signatures and
produced an impossible type at the user's construction site (e.g.
`new COGLayer({ getTileData: fn })` reported that `fn` was not
assignable to the intersection of base and COG signatures).
Split the base's declared prop shape from the overridable fields:
- `RasterTileLayerBaseProps<DataT>` = everything except the 3 overridable
- `ExtraProps` default = `Pick<RasterTileLayerProps<DataT>, 3 overridable>`
(preserves direct-use ergonomics)
- Class now extends `CompositeLayer<BaseProps & ExtraProps>`
Base-class code accesses the 3 overridable fields via a private
`_baseProps` typed cast; subclasses override the protected accessors
and never go through the cast. Net: direct users see the full
RasterTileLayerProps surface, subclasses replace the overridable
signatures cleanly, and the function-signature intersection is gone.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
RasterTileLayer abstraction in deck.gl-raster package
_getTilesetDescriptor → _tilesetDescriptor
_getGetTileData → _tileDataFn
_getRenderTile → _renderTileFn
The old `_getGetTileData` read as "get [the] getTileData" and collided
awkwardly with the callback it returned. The new names treat these as
accessor-style computed-property methods ("the currently effective X"),
which reads cleaner both at the base-class declaration and at subclass
override sites in COGLayer and ZarrLayer.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
… GetTileDataOptions Both are always populated by the base layer before invoking the user's `getTileData` callback — `device` from `this.context.device`, `signal` from deck.gl's per-tile lifecycle signal (optionally composed with the user's `signal` prop). Marking them required at the type level removes the `options.device!` and `options.signal!` non-null assertions that COGLayer and ZarrLayer were using to paper over the optional type. Also tightens the COG- and Zarr-specific `GetTileDataOptions.signal` to required, matching the base type. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The `T` suffix conventionally signals "this is a generic type parameter" (e.g. `DataT`, `ExtraProps`), but MinimalDataT is a plain type used as a constraint. Rename to MinimalTileData to drop the misleading suffix and clarify intent: it's the minimal shape a tile's data must satisfy. Also picks up a few formatting whitespace fixes from biome. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Adds braces around all single-statement if / else / for / while / do branches. Per-user preference for readability and an explicit visual block. Biome's style/useBlockStatements rule enforces this going forward. Auto-fixes applied with `biome check --write --unsafe` across 18 files in packages/ and examples/. Pure formatting — no behavior change; tests and typecheck unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
kylebarron
marked this pull request as ready for review
April 24, 2026 14:20
kylebarron
enabled auto-merge (squash)
April 24, 2026 14:21
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.
Problem
The
@developmentseed/deck.gl-rasterpackage providesRasterLayer(renders a single spatially-oriented texture) and tile utilities implementingTileset2D(RasterTileset2D,TileMatrixSetAdaptor,TilesetDescriptor). Wiring these into a full tiled raster layer currently lives inCOGLayer(indeck.gl-geotiff) and was largely duplicated intoZarrLayer(indeck.gl-zarr). Lonboard re-implements the same wiring a third time in its widget.Duplicated logic across these consumers includes:
RasterTileset2Dfactory subclass that captures the descriptor@deck.gl/geo-layersTileLayergetTileData/renderSubLayersCOORDINATE_SYSTEM.CARTESIAN,modelMatrix,coordinateOrigin)RasterLayerconstruction withreprojectionFnsand debug tile outlinesTileLayerpassthrough propssignalprop withTileLayer's per-tileAbortSignalGoals
RasterTileLayerin@developmentseed/deck.gl-rasterthat encapsulates the shared tiled-raster infrastructure.TilesetDescriptor(notably Lonboard).COGLayerandZarrLayercan expose a single "parse this source" prop to end users.COGLayerandZarrLayerto subclassRasterTileLayerwithout changing their public API.Inspired by
@deck.gl/geo-layers'sMVTLayer extends TileLayerpattern: the base class is usable directly, and subclasses customize by overriding protected methods and adding their own props.Non-Goals
COGLayerorZarrLayer.getTileData(consumer-supplied transforms attached to fetched data). The descriptor owns transforms; if a future use case requires per-tile overrides, an optional return field can be added without breaking the current contract.tileTransforminterface can represent non-affine transforms, but no GCP-based descriptor implementation is part of this work.Change list
RasterTileLayernew export from deck.gl-raster packageifandforstatements instead of on one line.Closes #404 , Closes #453