From 1d26440acbd952475f86180c1e058fd2600c2dd8 Mon Sep 17 00:00:00 2001 From: "s0wlz (Matthias Puchstein)" Date: Sat, 13 Dec 2025 19:18:50 +0100 Subject: [PATCH] Preserve source tile bounds during export --- export_heightmaps.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/export_heightmaps.py b/export_heightmaps.py index 9eba2c3..ff11c17 100644 --- a/export_heightmaps.py +++ b/export_heightmaps.py @@ -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