2.9 KiB
2.9 KiB
Repository Guidelines
Project Structure & Module Organization
export_heightmaps.pyis the main pipeline: buildswork/dgm.vrt, scales heights, and writesexport_unity/height_png16/*.pngplusexport_unity/tile_index.csv.export_ortho_tiles.pyexports orthophotos intoexport_unity/ortho_jpg/using the terrain manifest.- Raw inputs (
raw_dgm1/,raw_dop/,raw_3dgeb_lod1/,raw_3dgeb_lod2/) andwork/intermediates are intentionally untracked; do not commit them. export_unity/is safe to sync to Unity projects; treat it as generated output.
Build, Test, and Development Commands
- Create a venv:
uv venv && source .venv/bin/activate. Install deps:uv sync(generatesuv.lock). - If wheels fail, install system GDAL first (e.g.,
brew install gdalorapt-get install gdal-bin libgdal-dev), then rerunuv sync. - Heightmap export (rebuilds VRT if absent):
uv run python export_heightmaps.py. - Orthophoto export:
uv run python export_ortho_tiles.py(requires JP2s underraw_dop/jp2/). - Refresh VRT manually if needed:
gdalbuildvrt work/dgm.vrt raw_dgm1/*.tif. - Inspect a result:
gdalinfo export_unity/height_png16/<tile>.png | headto sanity-check bounds and scaling. - Expected warning:
Computed -srcwin ... falls partially outside source raster extentmeans the DOP coverage is slightly smaller than the tile footprint; edge pixels will be filled with NoData/zeros. Add adjacent JP2s or shrink the requested window if you need to silence it.
Coding Style & Naming Conventions
- Python scripts use 4-space indentation, early-exit error handling, and
SystemExitfor fatal issues; follow PEP 8 where practical. - Keep tile IDs stable (base filename without extension); avoid renaming inputs to reduce churn downstream.
- Prefer explicit constants for tunables (
OUT_RES,RESAMPLE,TILE_SIZE_M) and log with clear context.
Testing Guidelines
- No automated tests yet; rely on manual validation: run exports on a small tile subset, open outputs in
gdalinfoor GIS viewer, and confirmtile_index.csvaligns with Unity expectations. - When changing scaling or resolution, compare before/after stats (min/max) and spot-check terrain in Unity.
Commit & Pull Request Guidelines
- Commit messages are short, imperative summaries (e.g., "Ignore generated orthophotos"). Group related changes per commit; commit
uv.lockwhen dependency versions change. - Before opening a PR: describe the change, list commands run, note data locations (not committed), and include any screenshots from Unity/GIS if visuals changed.
- Ensure raw datasets and large intermediates stay out of git; verify
.gitignorestill covers generated files after changes.
Security & Data Handling
- Keep raw geodata local; avoid publishing source tiles or credentials. Document download sources/scripts instead of committing data.
- Outputs may be large; prefer syncing
export_unity/artifacts via project-specific channels rather than embedding in the repo.