Add uv setup and document expected orthophoto warnings

This commit is contained in:
2025-12-15 20:41:42 +01:00
parent e3ef575a4b
commit abb37f25e2
4 changed files with 91 additions and 4 deletions

View File

@@ -8,6 +8,11 @@ This repository converts DGM1 elevation tiles into Unity-ready 16-bit PNG height
- DGM1 source tiles placed in `raw_dgm1/` as `dgm1_<utm_zone>_<easting>_<northing>.tif` (with matching `.tfw` files).
- Raw inputs (`raw_dop/`, `raw_3dgeb_lod1/`, `raw_3dgeb_lod2/`) are **kept out of git**; keep them locally or document how to fetch/regenerate.
### Environment setup (uv)
- Create a project venv: `uv venv && source .venv/bin/activate`.
- Install dependencies from `pyproject.toml`: `uv sync` (generates `uv.lock`; warning-free with dependency-groups).
- If wheels fail to resolve, ensure system GDAL is present (e.g., `brew install gdal` or `apt-get install gdal-bin libgdal-dev`), then rerun `uv sync`.
### Repository Layout
- `raw_dgm1/` — input rasters (not versioned).
- `raw_dop/` — raw orthophoto downloads (JP2/J2W/XML), ignored in git.
@@ -21,15 +26,16 @@ This repository converts DGM1 elevation tiles into Unity-ready 16-bit PNG height
- `AGENTS.md` — contributor guide.
### Quick Start
1. Export Unity heightmaps and manifest (builds `work/dgm.vrt` automatically if missing):
1. Activate the uv venv (`source .venv/bin/activate`) or prefix commands with `uv run`.
2. Export Unity heightmaps and manifest (builds `work/dgm.vrt` automatically if missing):
```bash
python3 export_heightmaps.py
uv run python export_heightmaps.py
```
3. Import the PNGs into Unity Terrains using `tile_index.csv` for placement and consistent height scaling (065535).
### Key Commands
- Refresh VRT: `gdalbuildvrt work/dgm.vrt raw_dgm1/*.tif`
- Run export pipeline: `python3 export_heightmaps.py`
- Run export pipeline: `uv run python export_heightmaps.py`
- Inspect an output tile: `gdalinfo export_unity/height_png16/<tile>.png | head`
### Workflow Notes
@@ -44,9 +50,10 @@ This repository converts DGM1 elevation tiles into Unity-ready 16-bit PNG height
1. Ensure DOP JP2s are present in `raw_dop/jp2/` (use `raw_dop/dlscript.sh` if needed).
2. From `GeoData/`, run:
```bash
python3 export_ortho_tiles.py
uv run python export_ortho_tiles.py
```
This builds `work/dop.vrt` if missing and writes `export_unity/ortho_jpg/<tile>.jpg` + `.jgw` aligned to `tile_index.csv`.
- If you see `Computed -srcwin ... falls partially outside source raster extent` warnings, 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 avoid the warning.
### Buildings
The building export pipeline is temporarily disabled while we choose a mesh conversion approach (GDAL lacks a native OBJ writer). CityGML LoD2 sources remain in `raw_3dgeb_lod2/` locally (ignored in git); consider CityGML→glTF/OBJ tools (e.g., citygml-tools + cityjson2gltf) for future integration.