fix(mosaic): Make MosaicLayer repeat over world copies (antimeridian) - #639
Open
willjnz wants to merge 1 commit into
Open
fix(mosaic): Make MosaicLayer repeat over world copies (antimeridian)#639willjnz wants to merge 1 commit into
willjnz wants to merge 1 commit into
Conversation
MosaicTileset2D.getTileIndices queried its Flatbush spatial index once, using the viewport's raw (possibly unwrapped) longitude bounds. Once a WebMercatorViewport with repeat: true pans past +-180 degrees, viewportBounds extends past that range while sources are still indexed at their true, unwrapped bbox, so items on the far side of the antimeridian were never selected -- RasterTileLayer's own world-copy traversal (developmentseed#517 / developmentseed#518) never gets a chance to run, since a source's layer is never built if it's never selected. Repeats the query at world-copy offsets (same subViewports.length > 1 gate and MAX_MAPS walk-until-empty pattern as raster-tile-traversal.ts) shifting the search bounds by worldOffset * 360 degrees of longitude instead of translating a bounding volume, since Flatbush operates on WGS84 degrees rather than deck.gl common space. Documented as a second, independent layer in dev-docs/world-copies.md.
willjnz
force-pushed
the
mosaic-repeat-antimeridian
branch
from
August 25, 2026 05:18
065152b to
66568f0
Compare
Member
|
Thanks @willjnz; this looks reasonable but I'll need to take a closer look before merging. I'm focused on creating presentations for FOSS4G at the moment |
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.
Hey @kylebarron, great work - thank you very much.
I tried the beta v0.8 because I needed what I thought was fixed by #518. It turns out that fix doesn't make
MosaicLayerrepeat across world copies. This PR applies the same fix toMosaicLayer.There are two independent layers of "which things are visible" in this codebase:
RasterTileLayerdecides which pixel tiles(x, y, z)of that one file are visible. Fixed by fix: traverse tiles across world copies (#517) #518.MosaicLayer'sMosaicTileset2Ddecides which sources (whole COGs - e.g. STAC items) are visible at all, via a spatial query over their bounding boxes, before anyRasterTileLayerfor that source exists.#518 only fixed layer 1. If a source is never selected at layer 2, it never gets a
RasterTileLayerbuilt for it (renderSourcenever runs), so #518's fix never gets a chance to run.The root cause:
MosaicTileset2D.getTileIndicesqueried its Flatbush spatial index once, using the viewport's raw (possibly unwrapped) longitude bounds. Once aWebMercatorViewportwithrepeat: truepans past ±180°,viewportBoundsextends past that range while sources are still indexed at their true, unwrapped bbox - so items on the far side of the antimeridian were never selected.The fix repeats the query at world-copy offsets - same
subViewports.length > 1gate andMAX_MAPSwalk-until-empty pattern asraster-tile-traversal.ts- shifting the search bounds byworldOffset * 360°of longitude instead of translating a bounding volume, since Flatbush operates on WGS84 degrees, not deck.gl common space. Documented as a second, independent layer indev-docs/world-copies.md.Test example
Note: there is still a gap right at the antimeridian, because COGs with bounds of
-180to+180(antimeridian-spanning) are excluded - a known separate issue, unrelated to this fix. The geomad layer has some COGs that render badly before and after this PR for that reason; LULC does not.Minimal app to test