Skip to content

feat: Only load COGLayer at first in the example app - #80

Merged
kylebarron merged 1 commit into
mainfrom
kyle/only-load-cog-layer-first
Dec 18, 2025
Merged

kylebarron merged 1 commit into
mainfrom
kyle/only-load-cog-layer-first

Conversation

@kylebarron

Copy link
Copy Markdown
Member

There's something about the GeoTIFFLayer that seems to block the main thread?

@kylebarron
kylebarron merged commit 53c2a38 into main Dec 18, 2025
@kylebarron
kylebarron deleted the kyle/only-load-cog-layer-first branch December 18, 2025 22:34
@ds-release-bot ds-release-bot Bot mentioned this pull request Jan 26, 2026
@ds-release-bot ds-release-bot Bot mentioned this pull request Feb 20, 2026
kylebarron added a commit that referenced this pull request Oct 16, 2026
> [!NOTE]
> This PR was written by Claude (Claude Code), not by @kylebarron.

Closes #704.

LERC tiles from big endian (`MM`) files decoded byte-swapped. libtiff
swaps samples into the file's byte order before passing them to any
codec, LERC included, so the LERC data in a big endian file holds
byte-swapped values. #687 only swapped the output of codecs that return
raw bytes.

### Changes

- `decode()` now also byte-swaps the typed pixels a codec returns when
the file is big endian and samples are wider than 8 bits. In practice
that means LERC, LERC_DEFLATE and LERC_ZSTD. JPEG and WebP output is
8-bit, so it's untouched.
- The swap happens in place. The `lerc` package copies decoded pixels
out of WASM memory into a new buffer, so nothing else references it.
- `swapBytesInPlace` now takes a `Uint8Array`, because LERC bands are
`subarray` views into one shared buffer.

### Tests

- New unit test in `decode.test.ts`: decoding the existing
`float32_1band_lerc_block32` tile as big endian must give exactly the
little endian result with each sample's bytes reversed. It fails on
`main`.
- The second commit bumps `fixtures/geotiff-test-data` to pick up its
new big endian LERC fixtures (developmentseed/geotiff-test-data#81) and
adds both to `integration-rasterio.test.ts`:
`uint16_1band_lerc_block64_big_endian` and
`float32_1band_lerc_block64_big_endian`. Both fail `tile pixel data
matches` on `main` and pass here. The bump also brings in
geotiff-test-data #78–#80, which no test here uses.
- All package tests pass, including `geotiff` (166/166) with the
rasterio integration suite, and `pnpm typecheck` and `biome check` are
clean.

🤖 Written by [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant