Skip to content

feat(geotiff): thread AbortSignal through GeoTIFF open/fromUrl - #515

Merged
kylebarron merged 5 commits into
mainfrom
kyle/mosaic-layer-abort
May 7, 2026
Merged

kylebarron merged 5 commits into
mainfrom
kyle/mosaic-layer-abort

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Summary

  • Add optional signal: AbortSignal to GeoTIFF.open, GeoTIFF.fromTiff, GeoTIFF.fromUrl, and prefetchTags, threading through to Tiff.create, TiffImage.init, and TiffImage.fetch (all already supported by @cogeotiff/core v9.5.0).
  • Restore signal usage in the naip-mosaic example's getSource; the example previously discarded it as signal: _ with a TODO referencing Restore AbortSignal support in naip-mosaic example for opening COG headers #292.

Closes #292.

Test plan

  • pnpm --filter @developmentseed/geotiff typecheck
  • pnpm --filter @developmentseed/geotiff build
  • pnpm --filter naip-mosaic-example typecheck
  • pnpm check:fix clean
  • Run the naip-mosaic example, pan/zoom rapidly, and confirm in-flight COG header requests get aborted (no orphaned requests in network panel)

🤖 Generated with Claude Code

Adds optional `signal` to `GeoTIFF.open`, `GeoTIFF.fromTiff`, and
`GeoTIFF.fromUrl`, plus `prefetchTags`, so callers can cancel the header
reads issued during COG opening. The underlying `@cogeotiff/core` (v9.5.0)
exposes `signal` on `Tiff.create`, `TiffImage.init`, and `TiffImage.fetch`,
which we now pass through.

Restores `signal` usage in the naip-mosaic example's `getSource`, which
was disabled when the example switched to `@developmentseed/geotiff`.

Closes #292

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@github-actions github-actions Bot added the feat label May 7, 2026
…ze: Infinity

Previously the example used `maxCacheSize: Infinity` on the MosaicLayer to
keep cheap GeoTIFF header data around. The side-effect was that every parent
tile ever loaded stayed in the TileLayer's cache, which kept its inner
COGLayer mounted and its in-flight tile requests alive. When panning quickly
this filled Chrome's per-domain connection budget with requests for COGs no
longer in view.

Move header caching into a module-level `Map<url, Promise<GeoTIFF>>` so the
GeoTIFF instances persist across pans without pinning the rest of the
TileLayer state. Now when a parent MosaicLayer tile is evicted, deck.gl
finalizes the inner COGLayer, which aborts its in-flight tile requests via
the signal already wired through `_wrapGetTileData`.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Comment thread examples/naip-mosaic/src/App.tsx Resolved
kylebarron and others added 3 commits May 7, 2026 16:16
Pass the parent tile's AbortSignal into `GeoTIFF.fromUrl` so an in-flight
header read can be cancelled when the tile leaves view. The existing
.catch handler already evicts the cache entry on rejection, so an
AbortError now removes the entry and a later visit will restart the
fetch rather than reuse the rejected promise.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Explain why we cache the Promise rather than the resolved GeoTIFF (so
concurrent callers share one in-flight fetch) and document the
single-caller-per-URL assumption that keeps the simple signal-forwarding
correct in this example.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@kylebarron
kylebarron enabled auto-merge (squash) May 7, 2026 20:30
@kylebarron
kylebarron merged commit 6dd1dad into main May 7, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/mosaic-layer-abort branch May 7, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restore AbortSignal support in naip-mosaic example for opening COG headers

1 participant