From 83168119b815865302ceb720937fdcd9f063b86e Mon Sep 17 00:00:00 2001 From: "s0wlz (Matthias Puchstein)" Date: Sat, 13 Dec 2025 18:07:57 +0100 Subject: [PATCH] Improve heightmap export stability --- export_heightmaps.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/export_heightmaps.py b/export_heightmaps.py index 0a5395b..9eba2c3 100644 --- a/export_heightmaps.py +++ b/export_heightmaps.py @@ -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)