Skip to content

fix(deck.gl-geotiff): fill MultiCOGLayer edge-tile padding with nodata - #651

Closed
earlybard wants to merge 1 commit into
developmentseed:mainfrom
earlybard:fix/multi-cog-edge-tile-nodata
Closed

earlybard wants to merge 1 commit into
developmentseed:mainfrom
earlybard:fix/multi-cog-edge-tile-nodata

Conversation

@earlybard

@earlybard earlybard commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

What I am changing

MultiCOGLayer edge tiles now get their padding rewritten to the file's nodata value before upload, in both the primary and the stitched secondary path, so a nodata filter throws it away along with the real nodata. Files without a nodata value are left alone.

How you can test it

Any nodata-stamped COG that isn't a whole number of tiles wide. DEA's public Sentinel-2 ARD works, but it's Int16 so you need #650 as well:

const scene =
  "https://dea-public-data.s3.ap-southeast-2.amazonaws.com/baseline/ga_s2am_ard_3/55/HFB/2026/01/03/20260103T012735/ga_s2am_nbart_3-2-1_55HFB_2026-01-03_final_band";
new MultiCOGLayer({
  id: "s2",
  sources: {
    red: { url: `${scene}04.tif` },
    green: { url: `${scene}03.tif` },
    blue: { url: `${scene}02.tif` },
  },
  composite: { r: "red", g: "green", b: "blue" },
  renderPipeline: [
    { module: FilterNoDataVal, props: { value: -999 } },
    { module: LinearRescale, props: { rescaleMin: 0, rescaleMax: 3000 } },
  ],
});

Zoom out until the coarse overviews draw. On main there's a black band past the scene's right and bottom edges; with this it's transparent. Linear sampling still leaves a one-texel dark fringe where nodata blends into data; #640's bandSampler: nearest fixes that.

Related Issues

Related to #580, which clips the tile geometry to the array extent. This fixes the samples instead, so the two stack fine.

AI disclosure: written with Claude Code as a code assistant, reviewed by me.

@github-actions github-actions Bot added the fix label Sep 17, 2026
@earlybard
earlybard force-pushed the fix/multi-cog-edge-tile-nodata branch from 0579620 to 3300f54 Compare September 17, 2026 08:30
@earlybard
earlybard marked this pull request as ready for review September 17, 2026 08:39
MultiCOGLayer reads tiles boundless so every band texture has the nominal
tile size, which keeps the zero padding a COG stores past the image
bounds. Zeros sample as real data, so at a coarse overview an edge tile
draws an opaque band over its neighbours; on a scene whose coarsest
overview is a third padding that is a black L across the map. Edge tiles
now have their padding rewritten to the image's nodata value before
upload, in both the primary and the stitched secondary path, so one
nodata filter discards padding and fill alike. Images without a nodata
value are unchanged.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@earlybard
earlybard force-pushed the fix/multi-cog-edge-tile-nodata branch from 3300f54 to 04f1d35 Compare September 22, 2026 05:52
kylebarron added a commit that referenced this pull request Oct 21, 2026
> [!NOTE]
> This PR was written by Claude (Claude Code), not by @kylebarron.

`assembleTiles` now accepts a grid whose last column or row holds
clipped edge tiles, as `fetchTiles` returns them with `boundless:
false`. The output `width` and `height` no longer have to be multiples
of the tile size.

This is groundwork for having `MultiCOGLayer` stop drawing the padding
that edge tiles carry past the image edge. That padding holds whatever
the file's writer stored there (zeros in the DEA Sentinel-2 files from
#651, whose nodata is -999), so a nodata filter can't reliably hide it.
The fix is to fetch edge tiles with `boundless: false`, as `COGLayer`
already does, which returns them clipped to the image. `MultiCOGLayer`
stitches its coarser bands with `assembleTiles`, so the stitcher has to
accept clipped tiles first.

Each tile must still exactly fill its place in the grid: `tileWidth` x
`tileHeight`, or the clipped remainder in the last column or row.
Anything else throws a descriptive error, such as `Tile (1, 0) is 2x2,
expected 1x2`. Previously, a tile smaller than its place left a silent
gap of zeros in the output.

Ref #651

🤖 Written by [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
earlybard pushed a commit to earlybard/deck.gl-raster that referenced this pull request Oct 21, 2026
…tseed#755)

before (black border):

<img width="2800" height="1724" alt="before-fit"
src="https://github.com/user-attachments/assets/e42d808f-47a2-4593-9a76-5946aec0a98b"
/>

after:

<img width="2800" height="1724" alt="after-fit"
src="https://github.com/user-attachments/assets/d129b0e3-8bb5-4649-b14c-a357161a3669"
/>

before:

<img width="2800" height="1724" alt="3-before-20m-corner"
src="https://github.com/user-attachments/assets/dac357ee-9498-4210-977c-a1ca556ea766"
/>

after:

<img width="2800" height="1724" alt="4-after-20m-corner"
src="https://github.com/user-attachments/assets/b54ac9bb-2a70-4029-a86f-dd52a507770f"
/>

before and after for mollweide example (still broken 😄 )

<img width="2800" height="1724" alt="5-before-mollweide"
src="https://github.com/user-attachments/eassets/d7c6519a-6800-4f64-8de2-38209c7338fc"
/>
<img width="2800" height="1724" alt="6-after-mollweide"
src="https://github.com/user-attachments/assets/24ccfad8-7fe8-4604-98a4-c84f70bf82bf"
/>


-----



> [!NOTE]
> This PR was written by Claude (Claude Code), not by @kylebarron.

`MultiCOGLayer` now fetches edge tiles with `boundless: false`, as
`COGLayer` does, and meshes only the part of each tile inside the image.
Before, it drew every tile at full size, so the padding past the image's
right and bottom edges showed as a band past the scene. That padding
holds whatever the file's writer stored there, not necessarily nodata.
In Digital Earth Australia's Sentinel-2 files (nodata -999) it is 0,
which a nodata filter can't remove.

Coarser bands are stitched from clipped tiles too, which works because
every step uses the same clipped geometry:

- `AffineTilesetLevel.projectedTileCorners` clips the tiles in the last
column and row to the array (the change from developmentseed#580).
- `resolveSecondaryTiles` takes the stitched texture's size from the far
clipped corner, so it matches the UV transform it computes from the
clipped extents.
- `assembleTiles` already accepts clipped edge tiles (developmentseed#753).

Clipping the corners also affects `COGLayer` and `ZarrLayer`, which
already drew only the clipped part: their culling `bbox`, bounding
volumes, Web Mercator pole clamp, and debug outlines now match what they
draw. It also fixes developmentseed#580's case, a full-world Mollweide COG whose padded
corners fall outside the projection's domain, so every tile was culled.
That file now selects and draws tiles, though its polar tiles still
smear because pixels outside Mollweide's ellipse don't reproject, which
is a separate problem.

`dev-docs/boundless-tiles.md` is rewritten to match.

Closes developmentseed#580, closes developmentseed#651

🤖 Written by [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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