You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
COG tiles near ±180° longitude cause RasterReprojector mesh divergence in Web Mercator mode #366
When rendering an EPSG:4326 COG that spans the antimeridian (±180° longitude) in a Web Mercator viewport, tiles near the dateline cause RasterReprojector mesh refinement to diverge, producing mislocated rectangles across the map.
The root cause: forwardTo3857 maps nearby source coordinates on opposite sides of ±180° to EPSG:3857 x-values ~40 million meters apart (+20M vs -20M). The mesh triangles connecting these vertices span the entire map, and the reprojection error never converges (error=43200 pixels after 10001 iterations).
Reproduction
Load a global EPSG:4326 COG (e.g. WorldPop population data):
RasterReprojector: mesh refinement did not converge after 10001 iterations
(maxError=0.125, currentError=43200.00017279999)
Analysis
In _renderSubLayers, for Web Mercator viewports, reprojectionFns.forwardReproject is set to forwardTo3857. For tiles at the antimeridian, this projection has a discontinuity — longitude values like +179° and -179° (which are 2° apart geographically) map to x-values ~40M meters apart in EPSG:3857. The RasterReprojector mesh subdivision cannot resolve this discontinuity no matter how many iterations it runs.
Workaround
We're patching _renderSubLayers to detect antimeridian-crossing tiles by checking if the tile's corner x-coordinates in EPSG:3857 span more than half the world circumference. When detected, forwardTo3857 is wrapped to shift negative x-values by +circumference, making the mesh continuous:
We don't claim to support imagery spanning the antimeridian yet. See #171. You can test out #269 but it's vibe coded, this is important to get right, and I haven't had time to dive into it yet.
We have an example now of an image rendering correctly when its extent is (-180, -90, 180, 90)
I'll raise a PR tomorrow for the mesh divergence issue. My use case isn't "true" wrapping, just half pixel offset or floating point rounding errors.
My example COG has the following bbox: bounds: [-180.0012493, -72.0004162, 179.9987493, 83.9995832]. For this case just fixing the mesh divergence issue is sufficient.
I'll raise a PR tomorrow for the mesh divergence issue. My use case isn't "true" wrapping, just half pixel offset or floating point rounding errors.
My example COG has the following bbox: bounds: [-180.0012493, -72.0004162, 179.9987493, 83.9995832]. For this case just fixing the mesh divergence issue is sufficient.
FWIW this could also be solved with #351, by clamping the rendered part of the image and the mesh generation to the valid part of the coordinate space.
According to claude, those are the bounds of the valid portion of the image. But there are empty pixels on the right side of the image that overlap the antimeridian, and that's what it's crashing on.
Hopefully #714 will fix antimeridian handling. I'm planning to work through the internals of that today
Activity
kylebarron commentedon Mar 24, 2026
We don't claim to support imagery spanning the antimeridian yet. See #171. You can test out #269 but it's vibe coded, this is important to get right, and I haven't had time to dive into it yet.
We have an example now of an image rendering correctly when its extent is
(-180, -90, 180, 90)The Eoxcloudless example here https://developmentseed.org/deck.gl-raster/examples/cog-basic/
For imagery actually spanning the antimeridian, we'll probably implement some sort of clipping or wrapping, but I don't know the best approach yet.
Feel free to make a branch/PR and I can evaluate it in conjunction with #269.
james-willis commentedon Mar 25, 2026
I'll raise a PR tomorrow for the mesh divergence issue. My use case isn't "true" wrapping, just half pixel offset or floating point rounding errors.
My example COG has the following bbox:
bounds: [-180.0012493, -72.0004162, 179.9987493, 83.9995832]. For this case just fixing the mesh divergence issue is sufficient.fix: handle antimeridian-crossing tiles in Web Mercator reprojection
fix: handle antimeridian-crossing tiles in Web Mercator reprojection
kylebarron commentedon Apr 7, 2026
FWIW this could also be solved with #351, by clamping the rendered part of the image and the mesh generation to the valid part of the coordinate space.
feat: reprojector initial-triangulation seed + clamp Web Mercator mes…
willjnz commentedon Oct 15, 2026
I get this issue for images that are near the anti meridian, but do not cross. Here is an example https://dep-public-staging.s3.us-west-2.amazonaws.com/dep_ls_lulc/0-0-9/065/020/2025/dep_ls_lulc_065_020_2025.stac-item.json
It has 4326 bounds
[ 179.1054152054725, -18.47792657674854, 179.96779787822723, -17.65281330691017 ]kylebarron commentedon Oct 15, 2026
According to claude, those are the bounds of the valid portion of the image. But there are empty pixels on the right side of the image that overlap the antimeridian, and that's what it's crashing on.
Hopefully #714 will fix antimeridian handling. I'm planning to work through the internals of that today
test(raster-reproject): cover edge blocks whose padding crosses 180°
feat: draw imagery across the antimeridian in output mode (developmen…