Improve heightmap export stability
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user