Skip to content

chore: switch examples from @deck.gl/mapbox to @deck.gl/maplibre - #661

Closed
kylebarron wants to merge 1 commit into
mainfrom
kyle/deck-gl-maplibre
Closed

kylebarron wants to merge 1 commit into
mainfrom
kyle/deck-gl-maplibre

Conversation

@kylebarron

@kylebarron kylebarron commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

As of deck.gl 9.4, there's a new deck.gl/maplibre module instead of the only previous deck.gl/mapbox module.


Note

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

Switches the examples from @deck.gl/mapbox to the new @deck.gl/maplibre module in deck.gl 9.4: the shared DeckGlOverlay component now uses MapLibreOverlay instead of MapboxOverlay.

Draft: this is blocked on a bug in @deck.gl/maplibre 9.4.0. On first page load, interleaved layers that set beforeId are drawn on top of every MapLibre layer instead of at their beforeId position. It stays open as a reproduction for the upstream issue.

Reproduce

  1. On this branch, run pnpm install && pnpm build, then pnpm dev in examples/cog-globe.
  2. On first load, the basemap labels are hidden under the raster. They only show where the raster is transparent or beyond the edge of the globe.
  3. Pick another dataset in the panel and switch back. Now the labels draw above the raster, as beforeId: "boundary_country_outline" intends.

Cause

  • resolveMapLibreLayerGroups returns early unless map.isStyleLoaded(). In MapLibre, isStyleLoaded() requires every source's tiles and every image to have loaded, not just the style JSON (Style.loaded()).
  • The overlay only retries on styledata. On first load those events all fire while basemap tiles are still loading, so no layer group is ever added to the style.
  • afterMapLibreRender then draws any deck layer without a group after MapLibre has rendered, on top of everything.
  • Switching datasets re-renders the React app, and setProps calls the resolver again once everything has loaded, so the group lands in the right place.
  • @deck.gl/mapbox only checks map.style._loaded, which is true as soon as the style JSON has loaded.

🤖 Written by Claude Code on behalf of @kylebarron.

@github-actions github-actions Bot added the chore label Sep 22, 2026
kylebarron added a commit to developmentseed/lonboard that referenced this pull request Sep 29, 2026
> [!NOTE]
> This PR was written by Claude (Claude Code), not by @kylebarron.

Closes #1262

Upgrades to deck.gl 9.4 (the last v9 release), luma.gl 9.4, and
deck.gl-raster 0.8. deck.gl-raster 0.8 requires deck.gl 9.4.

## Changes

- **deck.gl and luma.gl:** `@deck.gl/*` → ^9.4.0 and `@luma.gl/*` →
^9.4.2. Both are updated in `package.json` and in the `overrides` in
`pnpm-workspace.yaml`. Those overrides keep a single copy of each
package, and they had held the lockfile at 9.3 even after `package.json`
was bumped.
- **deck.gl-raster family:** `@developmentseed/affine`,
`deck.gl-raster`, `morecantile` and `raster-reproject` → ^0.8.1
together. This removes the duplicate `@developmentseed/affine` 0.6.1 and
0.7.0 copies that `main` bundles today. It brings in deck.gl-raster's
fixes:
  - center-first tile loading, now handled by deck.gl 9.4 itself;
  - lighting turned off for raster layers;
  - `isLoaded` returning false while metadata loads;
  - tile traversal latitudes clamped to [-90, 90];
  - COG open failures reported through `onError`.
- **Undeclared dependencies:** `@deck.gl/aggregation-layers`,
`@deck.gl/geo-layers`, `@deck.gl/widgets` and `@luma.gl/core` are now
declared. They were imported in `src/`, or required as peers, but only
installed because pnpm installs missing peers automatically. The stale
`aggregation-layers` 9.3.1 peer was what caused an "unmet peer" warning.
- **loaders.gl:** the twelve loaders.gl packages that deck.gl and
luma.gl depend on directly are overridden to ~4.4.5.
- `@luma.gl/gltf` 9.4 requires loaders.gl ~4.4.5, while deck.gl 9.4
accepts ^4.4.3.
  - loaders.gl packages pin exact versions of each other.
- Without the overrides, a fresh resolution mixes 4.4.5 and 4.5.x. An
esbuild metafile showed that bundles seven loaders.gl packages twice.
- **dependabot:** `@developmentseed/*` is grouped with deck.gl, so the
family moves together.

### Not switching to `@deck.gl/maplibre` yet

9.4 adds `@deck.gl/maplibre` as the MapLibre replacement for
`@deck.gl/mapbox`. But in 9.4.0 it draws interleaved layers that set
`beforeId` above every MapLibre layer on first page load
(visgl/deck.gl#10733). That would break lonboard's `before_id`, so this
PR stays on `@deck.gl/mapbox` ^9.4.0. deck.gl-raster made the same call;
see developmentseed/deck.gl-raster#661. The fix, visgl/deck.gl#10734, is
open. The switch from `MapboxOverlay` to `MapLibreOverlay` in
`src/renderers/overlay.tsx` can happen once a release includes it;
that's tracked in #1273.

## Verification

**Picking.** deck.gl 9.4 drops the auto-generated
`instancePickingColors` attribute. Nothing in lonboard reads it, but the
existing UI tests never actually asserted that picking works. New
`tests/ui/test_picking.py` clicks a feature and checks that Python
receives the right `selected_index`, for scatterplot, path, polygon and
solid polygon layers. It passes on `main` (deck.gl 9.3) and on this
branch.

**Static HTML exports.** 15 exports were checked in headless Chromium on
both `main` and this branch: five layer types (scatterplot, path,
polygon, text, H3) in each of the `overlaid`, `interleaved` and
`reverse-controlled` modes.
- Hover tooltips appear in every case.
- The controls render the same way on both versions.
- No console errors.

**Raster.** A local tiled GeoTIFF rendered through
`RasterLayer.from_geotiff` and deck.gl-raster 0.8 displays correctly.

**Replacing a map.** Swapping one map for another in the same output
reuses the MapLibre instance (`reuseMaps`). It renders correctly in both
`overlaid` and `interleaved` modes, with no "WebGL context already
attached" error. That's the problem deck.gl-raster#668 hit under React
StrictMode.

**Checks:**
- `pnpm install --frozen-lockfile`: clean, with no peer-dependency
warnings.
- `biome check`: clean.
- `tsc --noEmit`: the same 8 errors as `main`, with identical messages.
- `pytest`: 226 passed, 1 skipped.

## Things to know

- **Bundle size:** the bundle grows from 3.46 MB to 3.76 MB (+297 KB,
about 8.6%). Most of that is deck.gl 9.4's WebGPU code, which is now
included by default. deck.gl offers a `visgl:webgl-only` export
condition to drop it, but it has no effect here, because `build.mjs`
aliases each `@deck.gl/*` package to a directory path, and export
conditions only apply to bare package names. Using it would mean
pointing the aliases at the `dist.webgl-only` builds; that's left for a
follow-up.
- **New console warnings:** luma.gl 9.4.x logs `WebGL uniform block
reflection failed for "gouraudMaterialUniforms"` / `"lightingUniforms"`
for lit layers such as polygons. Rendering is correct. This is
visgl/luma.gl#3187, fixed on luma.gl `master` in visgl/luma.gl#3190 but
not backported to the 9.4 branch (9.4.1 and 9.4.2 don't include it).
- **Beta:** this is a good point to cut `0.17.0-beta.2`.

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

Co-authored-by: Claude Opus 5.5 <[email protected]>
kylebarron added a commit that referenced this pull request Nov 24, 2026
…s redundant (#886)

> [!NOTE]
> This PR was written by Claude (Claude Code) on behalf of @kylebarron,
not by @kylebarron.

Closes #863

### Problem

deck.gl [9.4.2](https://github.com/visgl/deck.gl/releases/tag/v9.4.2)
includes visgl/deck.gl#10883:
- `Tileset2D.finalize` calls `onTileUnload` for every cached tile.
- A tile whose load finishes after it left the cache is unloaded instead
of reported loaded.

Our workarounds for 9.4.1 do the same thing. On 9.4.2, they unloaded
every tile twice. That destroyed default-pipeline textures twice and ran
user `onTileUnload` / `onSourceUnload` callbacks twice (#863). With the
lockfile moved to 9.4.2, five tests failed this way before this change.

### Change

This is option 2 from #863:
- Every `@deck.gl/*` spec, including peer deps, pnpm overrides and
examples, now requires `^9.4.2`. The lockfile moves only deck.gl.
- `RasterTileset2D`: removes the `finalize` override and the late-load
guard from #878. The `abortUnwantedLoads` wrapper of `onTileUnload`
stays.
- `MosaicTileset2D`: removes the `finalize` override. `reloadAll` stays,
because deck.gl's `reloadAll` still drops items without unloading them.
It now calls deck.gl's `finalize`.
- `custom-projection` example: removes its `finalize` override.
- `MosaicLayer.onSourceUnload` docs: an item that is still opening is
unloaded with no source, then again with its source once the open
finishes.
- `onnx-embeddings/NOTES.md`: no longer says the mid-load eviction leak
applies.

### Test plan

- [x] `deck.gl-raster` (263), `deck.gl-geotiff` (224) and `deck.gl-zarr`
(81) tests pass on 9.4.2.
- [x] One test encoded 9.4.1 behavior, with no unload at `finalize` for
a loading tile. It now expects an unload right away with no content,
then another once the data arrives.
- [x] `biome ci` passes.
- [ ] Not checked in a browser.

Follow-up: switch the examples to `@deck.gl/maplibre` (#661), which
visgl/deck.gl#10734 in 9.4.2 unblocks.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_011cLtCQHxJfGKqmXPYrjSPA

Co-authored-by: Claude Opus 5.5 <[email protected]>
kylebarron added a commit that referenced this pull request Nov 24, 2026
deck.gl 9.4.2 fixes `beforeId` on first load in `@deck.gl/maplibre`
(visgl/deck.gl#10734), which blocked this switch in #661.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011cLtCQHxJfGKqmXPYrjSPA
kylebarron added a commit that referenced this pull request Nov 24, 2026
> [!NOTE]
> This PR was written by Claude (Claude Code) on behalf of @kylebarron,
not by @kylebarron.

Needs deck.gl 9.4.2, from #886. Supersedes #661.

### Why

deck.gl 9.4 adds `@deck.gl/maplibre`. #661 switched to it, but stayed a
draft: with 9.4.0, interleaved layers that set `beforeId` were drawn
above every MapLibre layer on first load (visgl/deck.gl#10733).
visgl/deck.gl#10734 fixes that in 9.4.2.

### Change

- The shared `DeckGlOverlay` uses `MapLibreOverlay` instead of
`MapboxOverlay`.
- `@deck.gl/mapbox` is replaced by `@deck.gl/maplibre` in
`examples/_shared` and the root pnpm overrides.
- The `@ts-expect-error` comments on `beforeId` now name
`@deck.gl/maplibre`.

### Test plan

- [x] `biome ci`, and `typecheck` and `build` of every example, pass.
- [x] `cog-globe` in headless Chrome (SwiftShader), first load with no
interaction: basemap labels and country borders draw above the raster,
as `beforeId: "boundary_country_outline"` intends. That's the case that
failed in #661.
- [x] Every other example that uses `DeckGlOverlay`, in headless Chrome
on a real GPU (GTX 950, ANGLE Vulkan), first load with no interaction:
- Labels or borders draw above the deck.gl layers, as their `beforeId`
intends: `aef-mosaic`, `cog-basic`, `dynamical-zarr-ecmwf`,
`geoarrow-overlay`, `land-cover`, `naip-mosaic`, `nldas-icechunk`,
`onnx-embeddings`, `pmtiles-terrain`, `titiler-cog`,
`vermont-cog-comparison`, `vrt-mosaic`, `zarr-globe`.
- No `beforeId`, so the layer draws on top, as before: `sentinel-2`,
`usgs-topo`.
- No console errors in any of them. Each logs `luma.gl: Binding sampler
not set`; I didn't check whether `@deck.gl/mapbox` logs it too.
- [ ] `zarr-sentinel2-tci` not checked: it reads from
`http://localhost:8080/TCI.zarr`, which wasn't running.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_011cLtCQHxJfGKqmXPYrjSPA

Co-authored-by: Claude Opus 5.5 <[email protected]>
@kylebarron kylebarron closed this Nov 24, 2026
@kylebarron

Copy link
Copy Markdown
Member Author

Superseded by #887

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