Preserve source tile bounds during export

This commit is contained in:
2025-12-13 19:18:50 +01:00
parent 34a62a1269
commit 1d26440acb

View File

@@ -41,12 +41,11 @@ with open(manifest_path, "w", encoding="utf-8") as f:
gt = tds.GetGeoTransform()
ulx, xres, _, uly, _, yres = gt # yres typically negative in north-up rasters
# Snap tile bounds to the 1000 m grid to avoid drift/seams.
# (This also neutralizes the 1001×1001 overlap nuance.)
xmin = math.floor(ulx / TILE_SIZE_M) * TILE_SIZE_M
ymax = math.ceil(uly / TILE_SIZE_M) * TILE_SIZE_M
xmax = xmin + TILE_SIZE_M
ymin = ymax - TILE_SIZE_M
# Use the source tile footprint directly to avoid shifting during export.
xmax = ulx + xres * tds.RasterXSize
ymin = uly + yres * tds.RasterYSize
xmin = ulx
ymax = uly
base = os.path.splitext(os.path.basename(tif))[0]
tile_id = base # keep stable naming = easy re-export + reimport