Repository navigation
feat: measure mesh error in output pixels in every layer - #721
Merged
Merged
Conversation
RasterLayer now always builds its mesh with RasterReprojector's output mode, and RasterTileLayer gives every Web Mercator tile the antimeridian unwrap, which needs it. The experimental _errorSpace prop is removed from both layers; raster-reproject keeps both modes. Input mode alone drew tiles along the 180th meridian as streaks, overflowed the stack on some of them, and stalled on tiles touching 85.05 degrees. The examples lose their error-space toggles, and custom-projection its column stretch, which only imitated output-pixel error in input mode. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kylebarron
commented
Oct 16, 2026
| ? tile.meshInverseTransform | ||
| : tile.inverseTransform, | ||
| forwardTransform: tile.forwardTransform, | ||
| inverseTransform: tile.inverseTransform, |
Member
Author
There was a problem hiding this comment.
hmm, it would be kinda nice if we didn't even have to pass inverse transforms down into the layer.
Perhaps RasterLayer could only take forwardTransform and forwardReproject?
Perhaps we could have an overload for RasterReprojector to only require forward functions when error mode is output, not input?
| initialTriangulation, | ||
| _errorSpace, | ||
| // Output mode measures error on the map and never calls the inverse | ||
| // functions, which `_wrapX`'s unwrapped projection doesn't match. |
Member
Author
There was a problem hiding this comment.
which
_wrapX's unwrapped projection doesn't match
This text is unclear
…ixels Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
|
lgtm |
kylebarron
added a commit
that referenced
this pull request
Oct 16, 2026
main removed RasterTileLayer's `_errorSpace` prop (#721), so the conflict in raster-tile-layer.test.ts keeps this branch's zRange tests and drops the `_errorSpace` test that main deleted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 16, 2026
Closed
kylebarron
added a commit
that referenced
this pull request
Oct 22, 2026
<img width="2452" height="1283" alt="image" src="https://github.com/user-attachments/assets/1bb97dd6-112c-468b-8809-f76f4f6e602b" /> <img width="2121" height="1241" alt="image" src="https://github.com/user-attachments/assets/07cc4b99-ebf9-463d-9cbd-a596b58c8555" /> > [!NOTE] > This PR was written by Claude (Claude Code), not by @kylebarron. Adds `examples/explainers/antimeridian-explainer`, a step-by-step animation of how deck.gl-raster meshes an image that crosses the antimeridian (±180°). It replaces #703, which explained #673's design, with the mechanism on `main` today (#716 and #721). The explainer follows `antimeridian_UTM_60N.tif` from geotiff-test-data: 42 x 42 pixels of 20 km in UTM zone 60N, over the Aleutian Islands. It reads the file live from GitHub at a pinned commit. The maps draw Natural Earth's 1:50m land (public domain) under the meshes, also read live. In the close-up, the coastlines go over the image too, so the Aleutians show through it. If the land can't be read, the maps fall back to a plain graticule. There are nine steps: 1. **An image across 180°**: the image as stored, with the 180° meridian through it, and where it belongs on the map: at both edges. 2. **Two triangles**: the reprojector starts from two triangles. 3. **Project the corners**: proj4 returns every point in one copy of the world, so both triangles stretch across it. 4. **Refining can't fix it**: a time-lapse of the reprojector refining that projection. It stops at its cap, 20,001 triangles, still 616 output pixels off. 5. **Walk to the corners**: `unwrapAlong`'s walk from the image's center. Each sample is numbered, and shown where proj4 puts it, in a whole-world strip, and where it moves to, in a close-up of the seam. 6. **Snap every point**: the reprojector projects four check points in each triangle, 320 times in all for this image, and the layer snaps every one to the copy nearest the blend of the unwrapped corners. A probe, the explainer's own, sweeps the image to show it: proj4's answer jumps a world at 180°, while the snapped point moves smoothly. 7. **Mesh as usual**: the library's refinement of the snapped projection, replayed split by split. It finishes in 40 triangles. 8. **Cut at the world's edge**: `clipMeshToWorld` cuts the 10 triangles that cross -180° and moves the overhang one world over. 9. **On the map**: the world copies put the two parts back together at the seam. Steps 3, 5, 6 and 8 play in beats. Each press of Next plays one beat, so the image panel and the map panels can be followed one at a time. Every corner, sample, snapped point, split and cut comes from the functions `RasterLayer` calls, called in its order: - `makeUnwrappedReprojectionFns`, which uses `unwrapAlong` and `nearestCopy`; - `RasterReprojector`, with output-pixel error; - `clipMeshToWorld`. `makeUnwrappedReprojectionFns`, `clipMeshToWorld` and `rescaleEPSG3857ToCommonSpace` aren't exported from `@developmentseed/deck.gl-raster`, and its export map blocks deep imports. The explainer reaches them through a private alias in its own `vite.config.ts` and `tsconfig.json`, pointing at the built `dist/`. The package's exports don't change. Also included: - a card in the Explainers section of the docs examples page; - the design spec, `dev-docs/specs/2026-10-21-antimeridian-explainer-design.md`. As with the other explainers, the code is LLM-generated and unreviewed (see its README). Closes #703 🤖 Written by [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR was written by Claude (Claude Code), not by @kylebarron.
Every layer now measures mesh error in output pixels.
RasterLayeralways builds its mesh withRasterReprojector's output mode (#711), and so do the layers built onRasterTileLayer:COGLayer,ZarrLayerandMultiCOGLayer. The experimental_errorSpaceprop is removed fromRasterLayerandRasterTileLayer.@developmentseed/raster-reprojectkeeps both modes, and its own default stays"input".What changes for users
maxErroris in output pixels. The default is still 0.125. It now bounds how far the mesh may draw a point from where it belongs on the map, in units of one input pixel's size on the map, normally measured at the center of the meshed area. Before, it bounded a distance in the source image, found through the inverse projection._errorSpace: "output"was set, such a tile hit the iteration cap and was drawn the long way around the world. The globe is unchanged: it still draws a uniform grid.Why
Output mode needs only the forward projection, and #711 found it at least as accurate on screen in every case it measured. On a polar EPSG:3031 COG, input mode alone drew the tiles along the 180th meridian as streaks across the map, overflowed the stack on some of them, and stalled at the iteration cap on every tile touching 85.05°. Both modes fail on the tile that contains the pole.
Costs
Every tile meshed as
RasterTileLayermeshes it in Web Mercator, atmaxError0.125:Examples
meshXScalecolumn stretch, which only made input-pixel error track error on the map. Its polar views now take 25 to 35% fewer triangles and mesh about 5x faster.RasterReprojector.Tests
The layer tests now describe one mode.
RasterLayerbuilds its mesh when its inverse functions throw, and meshes an image across the antimeridian with_wrapXalone.RasterTileLayergives every Web Mercator tile_wrapX512, and globe tiles none. Sixdeck.gl-rastertests and eightdeck.gl-geotiffantimeridian fixture tests fail on main and pass here. The tests of the removed prop are gone.Not changed here
🤖 Written by Claude Code