Repository navigation
feat(geotiff): route fetchTiles through batched, range-coalescing getTiles - #531
Merged
Merged
Conversation
Closes the design phase for #407: fetchTiles should issue coalesced batched range requests via the getTiles/getMultipleBytes/coalesceRanges helpers vendored in #530, instead of Promise.all over fetchTile. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Splits fetchTile into "fetch compressed bytes" + "decode/assemble the RasterArray". No behavior change; assembleTile will be shared with the batched fetchTiles path. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
fetchTiles now resolves every requested tile's byte range up front and fetches the data through getTiles / getMultipleBytes (range-coalescing), instead of Promise.all over fetchTile. Both planar configurations: pixel-interleaved via getTiles; band-planar by flattening every (tile, band) range into one getMultipleBytes call and regrouping. The mask IFD, if any, is fetched the same batched way. Decoding is still per-tile via the shared assembleTile. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Covers fetchTiles vs per-tile fetchTile parity (pixel-interleaved, band-planar, masked), input-order preservation, boundless: false propagation, band-planar range coalescing, and empty input. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
kylebarron
marked this pull request as ready for review
May 12, 2026 21:06
kylebarron
added a commit
that referenced
this pull request
Oct 20, 2026
> [!NOTE] > This PR was written by Claude (Claude Code), not by @kylebarron. Bumps `version` to `0.9.0-beta.1` in the root `package.json` and in every `packages/*/package.json`, ready for a beta release. The publish workflow sees `beta` in the version and publishes to npm under the `beta` dist-tag, so `latest` stays on 0.8.1. `CHANGELOG.md` gets a `v0.9.0-beta.1` section listing the 44 PRs merged since v0.8.1, plus the two new contributors. This also drops the old "Unreleased" section: its three entries (#424, #530, #531) already shipped in v0.7.0. Once this is merged, tag the merge commit `v0.9.0-beta.1` and push the tag. 🤖 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.
What I am changing
fetchTilesnow issues coalesced batched HTTP range requests for tile (and mask) data, instead ofPromise.all(xy.map(fetchTile))— one independent request (orNfor band-planar COGs) per tile. This is the follow-up to #530, which vendoredgetTiles/getMultipleBytes/coalesceRangesbut leftfetchTilesunchanged. Closes #407.When the requested coordinates form a contiguous block — e.g. assembling a coarse tile from its finer covering tiles, or (future, #273) a debounce-coalesce middleware in front of deck.gl's per-tile fetches — the byte ranges are contiguous or near-contiguous on disk, so they collapse into far fewer reads (a 2×2 pixel-interleaved COG: 4 → 1; a 2×2 band-planar COG: 12 → 1).
fetchTile's observable behavior is unchanged.How I did it
refactor(geotiff): extract assembleTile from fetchTile— splitfetchTileinto "fetch the compressed bytes" + "decode/assemble theRasterArray". The decode half (assembleTile) is now shared byfetchTileandfetchTiles; only the I/O half differs.feat(geotiff): batch + coalesce reads in fetchTiles:fetchTilesresolves every requested tile's byte range up front, fetches data and mask concurrently, then decodes per tile viaassembleTile, in input order. Early-returns[]for empty input. Stale// TODO: coalesce …removed; JSDoc rewritten.fetchCogBytesMultiple(new): pixel-interleaved →getTiles; band-planar →fetchBandSeparateTileBytesMultiple; a sparse/missing tile throwsTile at (x, y) not found, matchingfetchCogBytes.fetchBandSeparateTileBytesMultiple(new): flattens every(tile, band)byte range into a singlegetMultipleBytescall so coalescing can merge across both bands and neighbouring tiles, then regroupssamplesPerPixelresults per tile.getTiles(self.maskImage, xy, …))._debuglogging still fires (now reporting the post-coalesce ranges).test(geotiff): parity + coalescing tests for batched fetchTiles— see below.coalesce/maxRangeSizeknobs throughfetchTiles' options; unifyingfetchTileonto the batched path; the deck.gl debounce-coalesce middleware (Extend deck.gl tile fetching to enable multi-tile fetches #273).dev-docs/specs/2026-05-12-fetch-tiles-coalesce-design.md.How you can test it
pnpm --filter @developmentseed/geotiff exec vitest run tests/fetch.test.ts— 18 passing. Newdescribe("fetchTiles")suite covers:fetchTilesresults are byte-for-byte equal to[fetchTile(x,y), …]for pixel-interleaved, band-planar, and masked fixtures;boundless: falsepropagates (edge tiles clipped to image bounds);dataSourceproxy shows a 2×2 pixel-interleaved COG drop from 4 reads to fewer, and a 2×2×3-band COG from 12 to fewer;[]with zero reads.pnpm --filter @developmentseed/geotiff typecheckandpnpm biome check packages/geotiff— clean.tests/integration-rasterio.test.tsfailures are pre-existing (the.npyreference fixtures underrasterio_generated/fixtures/<name>/aren't generated locally) and unrelated to this change — they fail identically onmain.Related Issues
fetchTiles#407🤖 Generated with Claude Code