Preserve source tile bounds during export
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user