Repository navigation
feat: Initial Globe view support - #563
Merged
Merged
Conversation
Scopes a working globe-view prototype (globe tile-selection bounding volume, lng/lat-direct render path via a shader unification, cog-globe and zarr-globe examples over MapLibre globe, throwaway anti-faceting scaffold) while deliberately carving out spherical-reprojection correctness as a follow-up design. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Replaces the assert(false) globe stub in computeBoundingVolume with an oriented bounding box built from WGS84 reference points projected onto the globe sphere via viewport.projectPosition. Makes the bounding-volume cache key projection-aware so globe and mercator volumes don't collide. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
kylebarron
commented
May 21, 2026
kylebarron
commented
May 21, 2026
kylebarron
commented
May 21, 2026
- Drop the projection-namespaced cache key; instead RasterTileset2D clears the BoundingVolumeCache when the viewport projection mode switches (globe<->mercator). Simpler z/x/y key; adds a clear() method. - Always use REF_POINTS_11 for the globe bounding volume. Our descriptor z is an internal overview index, not web-mercator zoom, so upstream's zoom-keyed point count doesn't transfer; a tile never spans more than the whole world, so 11 points always suffice and the cache makes the per-tile cost one-time. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
kylebarron
commented
May 21, 2026
kylebarron
commented
May 21, 2026
Follow the repo convention of aliasing deck.gl's underscore-prefixed exports (cf. _Tileset2D as Tileset2D). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Collapse SimpleMeshLayer's composeModelMatrix branch to one direct-projection path. MeshTextureLayer always draws one identity mesh at the origin, so projecting the mesh vertex directly is correct for both cartesian (Web Mercator) and lnglat (GlobeView). Fixes the globe path, which previously hit the meters-offset branch and ran project_size on lng/lat degrees. Behavior-preserving for mercator. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Collapse SimpleMeshLayer's composeModelMatrix branch to one direct-projection path. MeshTextureLayer always draws one identity mesh at the origin, so projecting the mesh vertex directly is correct for both cartesian (Web Mercator) and lnglat (GlobeView). Fixes the globe path, which previously hit the meters-offset branch and ran project_size on lng/lat degrees. Behavior-preserving for mercator. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
kylebarron
force-pushed
the
kyle/globe-view-may2026
branch
from
May 21, 2026 18:54
037f178 to
0f3691b
Compare
In globe mode, build a uniform per-tile grid instead of the adaptive Delatin mesh, whose reprojection-error metric is blind to sphere curvature and facets EPSG:4326 sources at low zoom. Stopgap only; to be removed when sphere-aware reprojection lands. Globe is detected via viewport.resolution (null-safe so direct _generateMesh calls in tests fall back to the reprojector path). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Standalone example rendering an EPSG:4326 COG on MapLibre's globe projection (projection="globe") with deck.gl interleaved. Exercises the globe tile-selection, lng/lat render path, and uniform-grid scaffold end-to-end. fitBounds frames the data wherever the COG sits. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
In globe mode the raster mesh is coplanar with MapLibre's basemap sphere and z-fights in the shared interleaved depth buffer. A depth bias does not help with maplibre's globe depth encoding; instead skip depth comparison (depthCompare: "always") and occlude the far hemisphere with back-face culling (cullMode: "back" for this grid's winding). Approach per visgl/deck.gl#9592. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Mirror cog-basic's source list + selector (and debug controls) so every COG source can be tested on the globe. fitBounds reframes on each switch. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The LOD meters-per-pixel read the latitude from the 3D oriented bounding box center, which on a globe is in globe common space (y far outside the Web Mercator world range), so worldToLngLat returned ~-89deg and cos(lat) made meters-per-pixel 10-270x too small. devicePixelsPerSource was then always >>1, so the traversal always recursed to the finest level -- loading the finest tiles across the whole globe when zoomed out. Drive the latitude from commonSpaceBounds instead, which is in Web Mercator world space in both the mercator and globe paths. Adds a regression test asserting LOD tracks zoom on a globe. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Adds a "Globe view (prototype)" section: lnglat-direct rendering, the two-coordinate-space tile selection, the LOD latitude gotcha (+ limb foreshortening caveat), the depthCompare/cullMode z-fighting recipe, and the throwaway anti-faceting grid. Links the globe-view spec. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Reconciles the globe-view work with #518 ("traverse tiles across world copies"), which refactored raster-tile-traversal.ts. The globe additions (globe bounding volume, REF_POINTS_11, lnglat LOD via getMetersPerPixelAtCommonSpaceBounds) layer onto main's worldOffset structure; update() now also destructures commonSpaceBounds for the LOD latitude. World-copy passes are gated on viewport.subViewports (>1), so they never run on a globe. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced May 22, 2026
Closed
kylebarron
commented
May 22, 2026
kylebarron
commented
May 22, 2026
Per review: the depthCompare/cullMode recipe for z-fighting against the basemap depends on the compositing context (MapLibre interleaved globe handedness vs a standalone _GlobeView), so it's an app decision, not a library one. RasterLayer no longer injects it; deck.gl forwards the `parameters` prop from COGLayer down to the mesh via getSubLayerProps, and the cog-globe example sets it. Also simplify the cog-globe README. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
kylebarron
marked this pull request as ready for review
May 22, 2026 16:01
This was referenced May 26, 2026
Closed
Contributor
|
nice |
thatbudakguy
added a commit
to OpenGeoMetadata/ogm-viewer
that referenced
this pull request
Sep 21, 2026
The COG preview has asked for a flat map since it was first drawn with deck.gl, because its tile traversal had no globe bounding volume to cull against. The comment saying so was optimistic - it claimed the COG still drew and only the console suffered. On the overlay we moved to in 31e2204 it drew nothing at all: the assert threw on every frame, no tile was ever selected, and the preview died on <ogm-map>'s load deadline with "The Cloud Optimized GeoTIFF preview timed out" filling the pane. developmentseed/deck.gl-raster#563 implemented that bounding volume, along with the cache-key fix a globe/mercator switch needs and the mesh shader change that puts lng/lat vertices on the sphere. It is published only as 0.8.0-beta.2; `latest` is still the 0.7.0 we were on, and upstream has landed nothing but dependency chores since June. So the three packages are pinned to that exact prerelease rather than carried on a range - a caret would take a beta.3 nobody has looked at. With that in, this preview has no projection of its own to ask for and takes MapPreviewer's globe default like everything else. The parameters it already passed deck.gl - depthCompare 'always', cullMode 'back' - turn out to be exactly what an interleaved overlay on MapLibre's globe needs, so they only needed explaining. One thing the bump doesn't bring. @deck.gl/maplibre chooses between a MapView and a GlobeView by asking the map which projection it is in, and it asks in two places: when its own props are set, and on 'styledata'. setProjection() raises 'projectiontransition' and no 'styledata' at all, so a reader pressing the globe button off left the overlay drawing through the GlobeView it was built with while MapLibre had gone back to flat - the COG 12px out at zoom 4, 80px at zoom 3, and staying there, because no pan, zoom or later frame is a style change either. Handing the overlay its layers again on 'projectiontransition' is the nudge; deck.gl matches the layer by id, so decoded tiles are kept. Verified in Chromium, since none of this is visible to the suite - a scalar LERC DEM through our own pipeline and a CONUS Albers COG through upstream's, both drawn on the globe with nothing in the console. Registration measured rather than eyeballed, by comparing map.project() with the deck viewport's own: 0px at every zoom from 1.5 to 16, 0.15px on the frame where the two hand over around MapLibre's globe-to-mercator transition, and 0px both ways across the globe button. Mercator is unchanged - both COGs render pixel-identically to 0.7.0. Co-Authored-By: Claude Opus 5 <[email protected]>
|
Hey @kylebarron, would these projection helpers be useful to you? visgl/deck.gl#10657 If so, I could push them out in a 9.4 patch. Also, would be great to know if shipping any of the extension fix PRs mentioned would unblock your follow ups, like |
Member
Author
|
I'm not sure yet; I think we're going to change how we measure projection error in #708 |
This was referenced Oct 21, 2026
kylebarron
added a commit
that referenced
this pull request
Nov 6, 2026
> [!NOTE] > This PR was written by Claude (Claude Code), not by @kylebarron. The globe-view prototype (#563) added a COG globe example, but nothing showed the Zarr path on a globe. This adds `examples/zarr-globe`, which animates ECMWF's AIFS Single 2 m temperature forecast on MapLibre's globe projection with deck.gl interleaved. It's the `dynamical-zarr-ecmwf` example on a globe, but reads a different forecast so that the whole visible half of the globe loads quickly. The shared globe render path already handles `ZarrLayer`, so no library changes are needed. ## Why AIFS Single, not the IFS ensemble `dynamical-zarr-ecmwf` reads the IFS ensemble (ENS). Each of its inner chunks holds 32x32 pixels for all 85 lead times and all 51 ensemble members, and the example draws one member. On a globe, the first view is 558 such tiles: about 1.3 GB in 558 requests, of which 2% is drawn, and it took 3.5 minutes to load. The AIFS Single store, from the same dynamical.org bucket, has no ensemble dimension, and each inner chunk holds 241x240 pixels (60°x60°) for all 61 lead times. The whole globe is 18 chunks, of 24-39 MB in total depending on the run. In Chrome, with the browser cache off, the example's first view loaded in about 7 seconds, from 22 requests and 24 MB. ## Changes - New `examples/zarr-globe` (package `deck.gl-zarr-globe-example`), with the data pipeline and controls of `dynamical-zarr-ecmwf`: it opens the store with `ZarrSource.open(store, { path })`, checks the data type with `is`, and passes the source to `ZarrLayer`. For the globe it follows `cog-globe`: `projection="globe"`, `parameters: { depthCompare: "always" }` on the layer so the raster does not z-fight the basemap sphere, and a black background around the globe. - Differences from `dynamical-zarr-ecmwf`, for AIFS: no ensemble member in the selection; 61 lead times at a fixed 6-hour step, so each frame shows for the same time (200 ms by default); a forecast run every 6 hours, with the run's hour next to the date picker; no `maxCacheSize`, so tiles stay cached as the globe turns; and a default colour range of -20 to 40 °C, which fits the temperatures in the default view better than -40 to 50 °C, while the filter keeps -40 to 50 °C. - Declares the grid `"spatial:registration": "node"`: the store's coordinates put each value on its grid point, from 90° to -90° and -180° to 179.75°. #862 makes the same change in `dynamical-zarr-ecmwf`. The edge cells reach 0.125° past the poles, which #858 clamps on the globe. - Uses the hosted Dark Matter style with `beforeId: "boundary_country_outline"`, as `cog-globe` does, instead of copying the flat example's custom water-less style. - Docs examples page: a "Globe View" card in the Zarr section, with a card image. The card shows +6 h of the 06 UTC run, midday over Africa. It was taken after #858, which fixed dots that showed where the far-side South Pole lands. - `pnpm-lock.yaml`: adds the new importer only. The docs workflow and the pnpm workspace already pick up `examples/*`. ## Tests - Example-only change, no new tests. The workspace typecheck and the example build pass, and Biome is clean. - Checked in Chrome: the forecast drapes on the globe with country borders and labels on top, with no z-fighting. Zooming in fetches nothing new, the animation advances one 6 h step every 200 ms, and the console shows no errors. ## Notes - Near the globe's limb the raster can stop short, leaving slivers of basemap. The cause isn't known yet. It would be in the shared globe path, so it is not addressed here. Closes #568 🤖 Written by [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Screen.Recording.2026-05-22.at.12.02.20.PM.mov
What I am changing
Adds prototype globe-view support to deck.gl-raster.
RasterTileLayer-basedlayers (COG/Zarr) can now render on a 3D globe — deck.gl
_GlobeView, orMapLibre
projection: 'globe'with deck.gl interleaved — not just the flat WebMercator map. Includes a new
cog-globeexample.Deliberately scoped as a prototype: it renders real data end-to-end and
exercises the full pipeline, with the harder accuracy work called out and
deferred (see Limitations). Design + deferred work:
dev-docs/specs/2026-05-21-globe-view-design.md.How I did it
computeBoundingVolume(was
assert(false)): sample reference points (REF_POINTS_11), reproject toWGS84, and project onto the sphere via
viewport.projectPositionfor thefrustum-culling oriented bounding box; keep a Web-Mercator-world AABB for the
dataset pre-filter and the LOD latitude. The bounding-volume cache is rebuilt
when the viewport projection mode switches (globe↔mercator).
coordinateSystem: 'lnglat'(mesh vertices in WGS84 via
projectTo4326) — no manual common-space mapping.Collapsed
SimpleMeshLayer'scomposeModelMatrixbranch in theMeshTextureLayervertex shader to a single direct-projection path (the oldbranch projected lng/lat degrees as if they were meters).
globe sphere in the shared interleaved depth buffer. A depth bias doesn't help
with maplibre's globe depth encoding; instead
depthCompare: 'always'+back-face culling (
cullMode: 'back'for this grid's winding). Seevisgl/deck.gl#9592.
bounds, not the 3D OBB center (globe-common →
worldToLngLatreturns ~-89°near the Mercator singularity → meters/px far too small → the traversal loads
the finest tiles across the whole globe when zoomed out).
instead of the adaptive Delatin mesh, whose reprojection-error metric is blind
to sphere curvature (an EPSG:4326 source yields 2 triangles that chord through
the sphere).
main, reconciling with fix: traverse tiles across world copies (#517) #518 (world copies); world-copy passes aregated on
viewport.subViewports, so they don't run on a globe.dev-docs/coordinate-systems.md.How you can test it
Confirm: the basemap renders as a 3D globe, the COG drapes onto the sphere and
lines up with the basemap (source selector to try several COGs), no z-fighting,
back-of-globe tiles are occluded, and LOD tracks zoom (coarse when zoomed out,
finer when zoomed in).
Unit tests:
pnpm --filter @developmentseed/deck.gl-raster test— globebounding volume, cache rebuild on projection switch, and a globe LOD regression
test.
Limitations (deferred — tracked as follow-up issues)
error metric is blind to sphere curvature; the uniform-grid scaffold is a
stopgap.
ignores globe foreshortening, so tiles near the limb slightly over-fetch
(never under). A screen-space-error metric would be exact.
zarr-globeexample (Add zarr-globe example #568) — not included yet.ClipExtension(Remove CutlineBbox module in favor of upstream ClipExtension #561).
Related Issues
Add zarr-globe example #568 (zarr-globe); cutline-on-globe depends on Remove CutlineBbox module in favor of upstream ClipExtension #561 (ClipExtension)