Skip to content

feat(examples): add an antimeridian explainer - #767

Merged
kylebarron merged 25 commits into
mainfrom
kyle/antimeridian-explainer
Oct 22, 2026
Merged

kylebarron merged 25 commits into
mainfrom
kyle/antimeridian-explainer

Conversation

@kylebarron

@kylebarron kylebarron commented Oct 21, 2026 •

Copy link
Copy Markdown
Member
image image

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

kylebarron and others added 19 commits October 21, 2026 15:49
How the mesh of an image that crosses 180° is built today: unwrap the corners, snap every point, mesh as usual, cut at the world's edge. Supersedes the explainer in #703, which explains #673's design.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The explainer reaches deck.gl-raster's unexported makeUnwrappedReprojectionFns, clipMeshToWorld and rescaleEPSG3857ToCommonSpace through a private alias in its own Vite and TypeScript config, pointing at the built dist/, so it runs the code RasterLayer runs without changing the package's exports.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each map framing is its own deck.gl view placed on the letterboxed slide, so it clips to its box and its camera is part of the frame. Layer ids name their view, and a layerFilter routes them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Step 8 gives the library's reason for the cut: the layer draws every tile inside one world.
- Step 6 keeps the probe's whole trail at its end.
- The walks are recorded from the library's own calls while it unwraps, so a change to its walk changes what step 5 shows, and a test catches a walk that stops starting at the center.
- Loading names the file and host, and gives up after 20 s with an error naming the file.
- Text says what is on screen: the meridian slants across this image; both raw west corners; every layer measures error on the map.
- Step 4 builds each snapshot's triangles once instead of every frame.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the feat label Oct 21, 2026
kylebarron and others added 6 commits October 21, 2026 19:08
A step can mark stops where the player holds until the presenter presses next (previous goes back one), shown as a beat counter beside the title. Step 5 now plays one walk sample per beat, in order: the walk reaches the point in the image, its raw position flies to the world strip, then its moved copy flies into the close-up. Steps 3, 6 and 8 hold between their phases, and step 6 sweeps once, holding on each side of 180°.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On a bare graticule it's hard to tell where the image is, or what the
world-spanning triangles cover. Every map view now draws Natural Earth's
1:50m land under the meshes, read live from GitHub alongside the image. Up
close, the coastlines also go over the image, so the Aleutians show through
it. In step 4, the smeared triangles now visibly cover Canada, Europe and
Asia.

The land is only the backdrop: if it can't be read, the app logs a warning
and the maps keep their graticule alone. The docs card is a new step 8 frame
with the land.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Step 5 ended with 24 unlabeled dots and 8 crossing lines. Each sample is now
numbered in the image and up close, each edge's cluster in the world strip
gets one label listing its samples, the center is labeled, and only the
latest sample keeps its leader. The leaders in steps 5 and 6 are dashed: a
move to another copy of the world, not a path like the walk's solid lines.

Step 6's sweeping probe read like the reprojector's own sampling. Its
description now says what the reprojector projects, four check points in
each triangle, 320 times in all for this image (counted from the library's
own calls, without the recorder's), and that the probe is the explainer's.
The probe is labeled in the image.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The close-up's seam label read "-180° = 180°", and the dashed seam ran
straight through the "=". It also didn't say which name goes with which
side. Now "180°" sits west of the line, where the map shows the copy of the
world to the west, and "-180°" sits east of it, at this world's west edge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n explainer

Rewords steps 1-5 of the antimeridian explainer, and replaces step 2's TODO
with a link to the reprojection explainer, for how the meshing works in
general.

Step 3 no longer quotes the corners' x, so the test that each description
uses the scene's own numbers now covers steps 4-8.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Steps 3 and 5 say proj4.js, while the rest of the explainer said proj4.
Step 3's caption, step 6's description and probe label, and the README's
steps now say proj4.js too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kylebarron
kylebarron enabled auto-merge (squash) October 22, 2026 15:56
@kylebarron
kylebarron disabled auto-merge October 22, 2026 15:57
@kylebarron
kylebarron merged commit 6bb5e26 into main Oct 22, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/antimeridian-explainer branch October 22, 2026 15:58
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