90f9eb0077d1d994f67031e4e7005d1a75790ffc
GeoData Heightmap Export
This repository converts DGM1 elevation tiles into Unity-ready 16-bit PNG heightmaps and a placement manifest. It relies on GDAL for mosaicking, resampling, and scaling to UInt16 ranges Unity expects.
Prerequisites
- GDAL installed with Python bindings (
osgeoimportable). - Python 3.9+ available on PATH.
- DGM1 source tiles placed in
raw_dgm1/asdgm1_<utm_zone>_<easting>_<northing>.tif(with matching.tfwfiles).
Repository Layout
raw_dgm1/— input rasters (not versioned).work/— intermediates such asdgm.vrtand_tmp.tiffiles; safe to delete/regenerate.export_unity/height_png16/— final 16-bit PNG heightmaps for Unity import.export_unity/tile_index.csv— manifest mapping tile IDs to world bounds and global min/max used for scaling.export_heightmaps.py— main export script.AGENTS.md— contributor guide.
Quick Start
- Build the VRT mosaic from raw tiles:
gdalbuildvrt work/dgm.vrt raw_dgm1/*.tif - Export Unity heightmaps and manifest:
python3 export_heightmaps.py - Import the PNGs into Unity Terrains using
tile_index.csvfor placement and consistent height scaling (0–65535).
Key Commands
- Refresh VRT:
gdalbuildvrt work/dgm.vrt raw_dgm1/*.tif - Run export pipeline:
python3 export_heightmaps.py - Inspect an output tile:
gdalinfo export_unity/height_png16/<tile>.png | head
Workflow Notes
- The script computes a global min/max from the VRT to scale all tiles consistently; adjust
OUT_RES,RESAMPLE, orTILE_SIZE_Minexport_heightmaps.pyif your AOI or target resolution changes. _tmp.tiffiles inwork/are transient; you can deletework/to force a clean rebuild.- Keep file names stable to avoid churn in Unity scenes; re-exports overwrite in place.
- Large raw datasets are intentionally excluded from version control—document download sources or scripts instead of committing data.***
Description
Languages
Python
61.4%
C#
29.9%
Shell
6.8%
Batchfile
1.9%