From 3d028f9f7b760eb0917e7b7bcbbd06412737c431 Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Wed, 17 Dec 2025 18:05:37 -0500 Subject: [PATCH] fix: Fix off-by-one error in RasterLayer mesh generation --- packages/deck.gl-raster/src/raster-layer.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/deck.gl-raster/src/raster-layer.ts b/packages/deck.gl-raster/src/raster-layer.ts index 3fa268d..42abdd8 100644 --- a/packages/deck.gl-raster/src/raster-layer.ts +++ b/packages/deck.gl-raster/src/raster-layer.ts @@ -141,7 +141,18 @@ export class RasterLayer extends CompositeLayer { debug = false, } = this.props; - const reprojector = new RasterReprojector(reprojectionFns, width, height); + // The mesh is lined up with the upper and left edges of the raster. So if + // we give the raster the same width and height as the number of pixels in + // the image, it'll be omitting the last row and column of pixels. + // + // To account for this, we add 1 to both width and height when generating + // the mesh. This also solves obvious gaps in between neighboring tiles in + // the COGLayer. + const reprojector = new RasterReprojector( + reprojectionFns, + width + 1, + height + 1, + ); reprojector.run(maxError); const { indices, positions, texCoords } = reprojectorToMesh(reprojector);