Improve heightmap export stability

This commit is contained in:
s0wlz (Matthias Puchstein)
2025-12-13 18:07:57 +01:00
parent 0896feaad0
commit 83168119b8

View File

@@ -23,8 +23,8 @@ if ds is None:
band = ds.GetRasterBand(1)
# Strategy B: compute global min/max for CURRENT downloaded AOI
gmin, gmax = band.ComputeRasterMinMax(True)
# Strategy B: compute global min/max for CURRENT downloaded AOI (full scan for stability)
gmin, gmax = band.ComputeRasterMinMax(False)
print(f"GLOBAL_MIN={gmin}, GLOBAL_MAX={gmax}")
# Export manifest for Unity placement later
@@ -59,7 +59,8 @@ with open(manifest_path, "w", encoding="utf-8") as f:
width=OUT_RES,
height=OUT_RES,
resampleAlg=RESAMPLE,
dstNodata=-9999,
srcNodata=-9999,
dstNodata=gmin, # fill nodata with global min to avoid deep pits
)
gdal.Warp(tmp_path, ds, options=warp_opts)