Skip to content

Explain reprojection antimeridian - #703

Closed
willjnz wants to merge 6 commits into
developmentseed:mainfrom
willjnz:explain-reprojection-antimeridian
Closed

willjnz wants to merge 6 commits into
developmentseed:mainfrom
willjnz:explain-reprojection-antimeridian

Conversation

@willjnz

@willjnz willjnz commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

This PR is very experimental. It is an attempt to explain the changes made in #673

Screenshot 2026-10-13 at 4 34 21 pm Screenshot 2026-10-13 at 4 34 27 pm Screenshot 2026-10-13 at 4 34 34 pm Screenshot 2026-10-13 at 4 34 45 pm Screenshot 2026-10-13 at 4 34 55 pm Screenshot 2026-10-13 at 4 35 13 pm

willjnz and others added 6 commits October 13, 2026 15:19
…ntil it is calculated. Don't show max error until it is calculated.
Take packages/raster-reproject's delatin.ts, index.ts and wrap-x.test.ts
from willjnz/antimeridian-crossing-fixes, so the antimeridian explainer can
use RasterReprojector's wrapX, snapToCopy and unwrapAlong. The rest of developmentseed#673
conflicts with main and isn't needed here; these files become no-ops once
developmentseed#673 lands.
Points at developmentseed/geotiff-test-data main, which includes the
antimeridian test images from developmentseed#72, including antimeridian_UTM_60N.tif.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A copy of the reprojection explainer that shows how RasterReprojector's
wrapX keeps a mesh in one piece across 180°, using
antimeridian_UTM_60N.tif. It shows the seed triangles smeared across the
world when proj4 wraps x, then each seed corner being unwrapped by
unwrapAlong and snapped with snapToCopy, then the refinement, where each new
vertex snaps to its triangle's interpolated x.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kylebarron kylebarron added this to the 0.9 milestone Oct 16, 2026
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]>
@kylebarron

Copy link
Copy Markdown
Member

Thanks for the PR/idea! A newer version of this was merged in #767, which uses the current antimeridian handling approach on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants