Skip to content

feat: Update land-cover example to have filterable categories - #506

Merged
kylebarron merged 15 commits into
mainfrom
kyle/nlcd-category-filter
May 6, 2026
Merged

kylebarron merged 15 commits into
mainfrom
kyle/nlcd-category-filter

Conversation

@kylebarron

@kylebarron kylebarron commented May 5, 2026 •

Copy link
Copy Markdown
Member
Screen.Recording.2026-05-05.at.9.52.31.AM.mov

Change list

  • Changes land-cover example to upload the texture to the GPU as uint8 non-normalized texture values
  • Add boolean lookup table to decide from the selection UI which classification values should be drawn. Then, for any values where the lookup table resolves to 0, discard those pixels.

kylebarron and others added 11 commits May 4, 2026 12:53
Captures the agreed approach for adding a category-filter UI to the
land-cover example, including the switch to r8uint upload and three
example-local shader modules wired via custom getTileData/renderTile.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Move the NLCD category list out of Legend.tsx so the upcoming
CategoryFilter UI and colormap-texture builder can share a single
source of truth.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Three example-local shader modules for the upcoming category-filter
pipeline:

- CreateTextureUint samples an r8uint source via usampler2D and
  introduces an `ivec4 icolor` function-local for downstream modules.
- FilterCategory discards via a 256-byte LUT texture indexed by
  icolor.r.
- PaletteColormap maps icolor.r to RGBA via texelFetch into a 256x1
  colormap texture and writes it to color.

The framework macro signature is unchanged. Integer pixel data flows
between modules through a function-local `ivec4 icolor` declared by
the producer module and consumed by the rest. luma.gl concatenates all
fs:DECKGL_FILTER_COLOR injections into one function body, so the
declaration is in scope for every subsequent injection. A future,
typed shader-module abstraction can supersede this convention; tracked
in the spec as an open follow-up.

Adds @luma.gl/shadertools as a dependency of the example.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Pure helpers for constructing the two textures the integer-aware
pipeline expects: a 256x1 RGBA colormap (alpha=0 at nodata, via
parseColormap) and a 256x1 r8 boolean LUT for the active category
selection.

Adds @developmentseed/geotiff as a direct dependency of the example
for parseColormap.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
getTileData uploads tiles as r8uint instead of the inferred r8unorm.
makeRenderTile composes the integer-aware shader pipeline once the
colormap and filter-LUT textures are available; until then it returns
null so the layer renders nothing.

Adds @developmentseed/deck.gl-raster as a direct dependency of the
example for the RenderTileResult type.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Controlled checkbox tree mirroring the existing legend's grouping. Each
heading toggles every leaf beneath it and renders indeterminate when
its leaves are partially selected.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
App captures the luma.gl Device on first tile load, builds the
colormap texture once the GeoTIFF metadata is parsed, and rebuilds
the filter LUT texture whenever the user changes the category
selection. CategoryFilter replaces the read-only Legend.

Also widens COGLayer's user-facing renderTile prop type to allow
returning null, matching the underlying RasterTileLayer capability
added in #489.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- "All categories" master checkbox toggles every leaf, with the
  indeterminate state (the "minus" box) shown when partial.
- Each heading is independently expandable/collapsible so the panel
  stays compact while the user drills into specific groups.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The colormap entry for the nodata index already has alpha=0 (set by
parseColormap). Convert that signal into an explicit discard so the
fragment is skipped entirely rather than relying on alpha-blended-to-
zero, which would still pollute the depth buffer and consume blend
bandwidth for invisible pixels.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@github-actions github-actions Bot added the docs label May 5, 2026
@kylebarron kylebarron changed the title docs: add design for NLCD category-filter example feat: Update land-cover example to have filterable categories May 5, 2026
@github-actions github-actions Bot added feat and removed docs labels May 5, 2026
@kylebarron

kylebarron commented May 5, 2026 •

Copy link
Copy Markdown
Member Author

We really need to implement #500. Right now it's fetching 32kb regions at a time when reading header metadata

@kylebarron
kylebarron marked this pull request as ready for review May 5, 2026 16:16
kylebarron and others added 3 commits May 6, 2026 10:48
Replaces the getTileData wrapper that captured the Device on first
tile load with the cleaner onDeviceInitialized callback on
DeckGLOverlay, matching the pattern used in dynamical-zarr-ecmwf and
naip-mosaic. Drops the customGetTileData useCallback entirely.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@kylebarron
kylebarron enabled auto-merge (squash) May 6, 2026 15:51
@kylebarron
kylebarron merged commit 8adf3e9 into main May 6, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/nlcd-category-filter branch May 6, 2026 15:55
@kylebarron
kylebarron restored the kyle/nlcd-category-filter branch May 7, 2026 20:43
@kylebarron
kylebarron deleted the kyle/nlcd-category-filter branch May 7, 2026 20:45
@kylebarron kylebarron self-assigned this May 26, 2026
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