Skip to content

fix(geozarr): order multiscales levels finest first by pixel size - #851

Merged
kylebarron merged 1 commit into
mainfrom
kyle/geozarr-sort-levels
Nov 6, 2026
Merged

kylebarron merged 1 commit into
mainfrom
kyle/geozarr-sort-levels

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Note

This PR was written by Claude (Claude Code), not by @kylebarron.

parseGeoZarrMetadata now orders a multiscales group's levels finest first by pixel size, whatever order the group's layout lists them in.

The multiscales convention doesn't fix the order of layout (zarr-conventions/multiscales#31), and its DEM example lists an upsampled 10 m level last, after 270 m. parseGeoZarrMetadata kept the layout's order but documented it as finest first, and geoZarrToDescriptor reverses it to get the tile grid's coarsest-first levels. So a layout in any other order gave ZarrLayer a tile grid whose levels weren't in resolution order.

A level's pixel size is the geometric mean of its pixel width and height, sqrt(|a * e|). That's the measure AffineTilesetLevel uses for metersPerPixel, so the tile grid's levels come out in the order it compares them in. Levels of the same pixel size, such as one with pixels 20 x 20 and one with pixels 10 x 40, keep the layout's order.

Tests

  • A new parse.test.ts test lists four levels as the DEM example does (30, 90, 270, then 10 m) and checks that they come out 10, 30, 90, 270. It fails without the sort.
  • The geozarr and deck.gl-zarr tests, pnpm -r --filter='!docs' typecheck and Biome pass.

🤖 Written by Claude Code

The multiscales convention doesn't fix the order of `layout`; its DEM
example lists an upsampled level last. parseGeoZarrMetadata kept the
layout's order and said it was finest first, so a layout in another order
gave ZarrLayer a tile grid with its levels out of order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the fix label Nov 6, 2026

@kylebarron kylebarron left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅

@kylebarron
kylebarron merged commit 7e71d4f into main Nov 6, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/geozarr-sort-levels branch November 6, 2026 15:52
kylebarron added a commit that referenced this pull request Nov 6, 2026
> [!NOTE]
> This PR was written by Claude (Claude Code), not by @kylebarron.

Bumps `version` to `0.10.0-beta.4` in the root `package.json` and in
every `packages/*/package.json`. The publish workflow publishes it under
the `beta` dist-tag, so `latest` doesn't change.

`CHANGELOG.md` gets a `v0.10.0-beta.4` section with GitHub's generated
notes for the 6 PRs merged since v0.10.0-beta.3.

## Breaking changes

- #837: `DEFAULT_RANGE_READER` moves from
`@developmentseed/deck.gl-geotiff` to `@developmentseed/deck.gl-raster`.
- #838: `ZarrSource.open` takes the store and a `path` option, instead
of a group you opened and `variable`. ZarrLayer's `source` takes a store
too.
- `open` returns a general `ZarrSource`. Narrow its data type with
`source.is("float32")`.
  - `source.arrays` is renamed to `source.levels`.
- `ZarrSource`, `ZarrLayer` and `ZarrLayerProps` lose their `Store` type
argument.

## Behavior changes

- #838: an array passed in inherits its parent group's `proj:` and
`spatial:` attributes, unless you pass `geoZarrMetadata`.
- #851: `parseGeoZarrMetadata` orders a multiscales group's levels
finest first by pixel size, whatever order its `layout` lists them in.
- #848: a change to `MosaicLayer`'s `updateTriggers.getSource` (or
`all`) unloads every item's source and opens the sources in view again.
The old items stop drawing at once.

## New APIs

- #792: `read({ window, pool, signal })` on `GeoTIFF` and `Overview`,
with the `Window` type and the `WindowError` class.
- #838: `ZarrSource.is(dtype)` and `source.node`.

## Not included

The fix for #826 (the range reader sends a read again when it arrives as
the stream holding its bytes finishes) isn't written yet.

🤖 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant