Repository navigation
feat(geotiff): thread AbortSignal through GeoTIFF open/fromUrl - #515
Merged
Merged
Conversation
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]>
…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]>
kylebarron
commented
May 7, 2026
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]>
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.
Summary
signal: AbortSignaltoGeoTIFF.open,GeoTIFF.fromTiff,GeoTIFF.fromUrl, andprefetchTags, threading through toTiff.create,TiffImage.init, andTiffImage.fetch(all already supported by@cogeotiff/corev9.5.0).getSource; the example previously discarded it assignal: _with a TODO referencing Restore AbortSignal support in naip-mosaic example for opening COG headers #292.Closes #292.
Test plan
pnpm --filter @developmentseed/geotiff typecheckpnpm --filter @developmentseed/geotiff buildpnpm --filter naip-mosaic-example typecheckpnpm check:fixclean🤖 Generated with Claude Code