Skip to content

refactor(deck.gl-raster)!: remove CutlineBbox in favor of deck.gl's ClipExtension - #739

Merged
kylebarron merged 1 commit into
mainfrom
kyle/remove-cutline-bbox
Oct 21, 2026
Merged

kylebarron merged 1 commit into
mainfrom
kyle/remove-cutline-bbox

Conversation

@kylebarron

@kylebarron kylebarron commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

We originally created the CutlineBbox module in order to clip a collar from a GeoTIFF. But I didn't realize that this was actually totally unnecessary because upstream already has a ClipExtension module.

Beyond the duplication, the ClipExtension is also higher precision at higher zooms.


Note

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

Removes the CutlineBbox GPU module and its CutlineBboxProps type from @developmentseed/deck.gl-raster/gpu-modules. deck.gl's ClipExtension does the same job and is more precise at high zoom: CutlineBbox compares only the float32 high part of an absolute common-space position, so its east-west cut edges drift by several metres from z15 on (measurements in #561). ClipExtension compares camera-relative positions that include the fp64 low part.

Breaking: CutlineBbox and CutlineBboxProps are no longer exported. To migrate, pass the same common-space bbox to ClipExtension:

import { ClipExtension } from "@deck.gl/extensions";

new COGLayer({
  // ...
  extensions: [new ClipExtension()],
  // @ts-expect-error clipBounds + clipByInstance are injected by ClipExtension
  clipBounds: [minX, minY, maxX, maxY],
  // Clip per pixel; auto-detect would pick per-vertex clipping on the mesh.
  clipByInstance: false,
});

Other changes:

  • The usgs-topo-cutline example now uses ClipExtension, and its renderTile is just CreateTexture.
  • Removed the CutlineBbox docs cross-links (and a stale lngLatToMercator link to a function that no longer exists).
  • Removed CutlineBbox from dev-docs/gpu-modules.md.

I checked the example in Chrome. With the cutline on, the collar is clipped, and turning it off brings the collar back. At z17, centred on the quad's north edge, the cut lands exactly on the centre row.

Closes #561

🤖 Written by Claude Code

…lipExtension

CutlineBbox duplicated deck.gl's ClipExtension and loses precision at
high zoom: it compares only the float32 high part of an absolute
common-space position, so east-west cut edges drift by a few metres at
z15+. ClipExtension compares camera-relative positions that include the
fp64 low part.

The usgs-topo-cutline example now clips with ClipExtension.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bbox: [number, number, number, number],
): RenderTileResult {
/** Render pipeline that only uploads the tile texture. */
function renderTile(tileData: TextureDataT): RenderTileResult {

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.

In a follow up PR we can simplify this example. It shouldn't need any custom render pipeline. And we can change the example name to just usgs-topo

@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.

lgtm

@kylebarron
kylebarron merged commit f8cb3ef into main Oct 21, 2026
5 checks passed
@kylebarron
kylebarron deleted the kyle/remove-cutline-bbox branch October 21, 2026 00:21
kylebarron added a commit that referenced this pull request Oct 21, 2026
… default pipeline (#741)

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

Renames the `usgs-topo-cutline` example to `usgs-topo` and removes its
custom tile pipeline.

- **Default pipeline:** the example's `getTileData` padded RGB to RGBA
and uploaded a texture, and its `renderTile` returned only
`CreateTexture`. `COGLayer`'s inferred pipeline does the same for these
JPEG-compressed RGB sheets and destroys its own textures, so the custom
`getTileData`, `renderTile`, `onTileUnload`, the `rgbToRgba` helper and
the `../../../packages/deck.gl-geotiff/dist` type import are gone. Since
#739 the collar is cut with `ClipExtension`, which doesn't need a
render-pipeline module.
- **Rename:** updated the folder, the package name
(`deck.gl-usgs-topo-example`), the `publish` script, the vite `base`,
the page title and the control panel's source link.
- **Dependencies:** dropped `@developmentseed/deck.gl-raster` and
`@developmentseed/geotiff`, which the example no longer imports. What's
left matches `cog-basic`.

The deployed URL moves from `/examples/usgs-topo-cutline/` to
`/examples/usgs-topo/`. The old URL will 404. Nothing on the docs site
links to it.

I checked the example in Chrome. With the default pipeline, the Emigrant
Gap (1955) and Moab (1885) sheets render with the same colours as
before, and the cutline on/off toggle still works.

Closes #740

🤖 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 Oct 21, 2026
> [!NOTE]
> This PR was written by Claude (Claude Code), not by @kylebarron.

Bumps `version` to `0.9.0-beta.2` in the root `package.json` and in
every `packages/*/package.json`, ready for a second 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.2` section listing the 7 PRs merged
since v0.9.0-beta.1. One of them is breaking: #739 removes `CutlineBbox`
and `CutlineBboxProps` from
`@developmentseed/deck.gl-raster/gpu-modules` in favor of deck.gl's
`ClipExtension`.

Once this is merged, tag the merge commit `v0.9.0-beta.2` and push the
tag.

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

Co-authored-by: Claude Opus 5.5 <[email protected]>
@willjnz willjnz mentioned this pull request Oct 21, 2026
4 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove CutlineBbox module in favor of upstream ClipExtension

1 participant