Make setup non-exporting and rename archive flag
This commit is contained in:
@@ -12,10 +12,10 @@
|
||||
- If wheels fail, install system GDAL first (e.g., `brew install gdal` or `apt-get install gdal-bin libgdal-dev`), then rerun `uv sync`.
|
||||
- Prepare the directory tree and config: `uv run python geodata_to_unity.py --setup` (or `bash scripts/setup_dirs.sh` for directories only).
|
||||
- Heightmap export: `uv run python geodata_to_unity.py --export heightmap`.
|
||||
- Orthophoto export: `uv run python geodata_to_unity.py --export textures` (requires JP2s under `raw/dop20/jp2/`; use `bash scripts/dlscript_dop20.sh` to fetch JP2/J2W/XML listed in `raw/dop20/filelist.txt`).
|
||||
- Orthophoto export: `uv run python geodata_to_unity.py --export textures` (requires JP2s under `raw/dop20/jp2/`; use `bash scripts/dlscript_dop20.sh` to fetch JP2/J2W/XML listed in `archive/dop20/filelist.txt`).
|
||||
- Refresh VRT manually if needed: `gdalbuildvrt work/dgm.vrt raw/dgm1/*.tif`.
|
||||
- Inspect a result: `gdalinfo export_unity/height_png16/<tile>.png | head` to sanity-check bounds and scaling.
|
||||
- Populate raw data from archives: `uv run python geodata_to_unity.py --use-archive --export all` (unzips `archive/*` and copies dop20 filelist).
|
||||
- Populate raw data from archives: `uv run python geodata_to_unity.py --build-from-archive --export all` (unzips `archive/*`; dop20 filelist stays in archive for the downloader).
|
||||
- Rebuild VRTs after moving data: add `--force-vrt`.
|
||||
- Expected warning: `Computed -srcwin ... falls partially outside source raster extent` means 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.
|
||||
- Scripts accept CLI overrides (e.g., `--config`, `--raw-dgm1-path`, `--raw-dop20-path`, `--export`); run `uv run python geodata_to_unity.py -h` to see options.
|
||||
|
||||
@@ -42,7 +42,7 @@ This repository converts DGM1 elevation tiles into Unity-ready 16-bit PNG height
|
||||
- Run export pipeline: `uv run python geodata_to_unity.py --export all`
|
||||
- Inspect an output tile: `gdalinfo export_unity/height_png16/<tile>.png | head`
|
||||
- Override config paths: use `--config <path>`, `--raw-dgm1-path <dir>`, `--raw-dop20-path <dir>`.
|
||||
- Use archives to populate raws: `uv run python geodata_to_unity.py --use-archive --export all` (unzips `archive/*` and copies dop20 filelist).
|
||||
- Build raws from archives: `uv run python geodata_to_unity.py --build-from-archive --export all` (unzips `archive/*`; dop20 filelist stays in `archive/dop20/` for the downloader).
|
||||
- Rebuild VRTs after moving data: add `--force-vrt`.
|
||||
|
||||
### Workflow Notes
|
||||
@@ -50,11 +50,11 @@ This repository converts DGM1 elevation tiles into Unity-ready 16-bit PNG height
|
||||
- `_tmp.tif` files in `work/` are transient; you can delete `work/` 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.
|
||||
- Additional inputs: download helper lives in `scripts/dlscript_dop20.sh` and pulls JP2/J2W/XML orthophotos listed in `raw/dop20/filelist.txt` (one URL per line); `archive/` can hold zipped 3D building tiles for future use.
|
||||
- Additional inputs: download helper lives in `scripts/dlscript_dop20.sh` and pulls JP2/J2W/XML orthophotos listed in `archive/dop20/filelist.txt` (one URL per line); `archive/` can hold zipped 3D building tiles for future use.
|
||||
- Handoff to Unity: copy/sync `export_unity/height_png16/` and `export_unity/tile_index.csv` into `DTrierFlood/Assets/GeoData/` before running the Unity-side importer. Keep `heightmap.out_res` aligned with the importer’s expected resolution (currently 1025).
|
||||
|
||||
### Orthophotos (textures)
|
||||
1. Ensure DOP JP2s are present in `raw/dop20/jp2/`; use `scripts/dlscript_dop20.sh` to fetch JP2/J2W/XML entries listed in `raw/dop20/filelist.txt` (one URL per line).
|
||||
1. Ensure DOP assets are present in `raw/dop20/jp2/`, `raw/dop20/j2w/`, and `raw/dop20/meta/`; use `scripts/dlscript_dop20.sh` to fetch JP2/J2W/XML entries listed in `archive/dop20/filelist.txt` (one URL per line).
|
||||
2. From `GeoData/`, run:
|
||||
```bash
|
||||
uv run python geodata_to_unity.py --export textures
|
||||
|
||||
@@ -29,14 +29,14 @@ def parse_args(argv: Iterable[str] | None = None) -> argparse.Namespace:
|
||||
parser.add_argument("--raw-dgm1-path", dest="raw_dgm1_path", help="Override raw DGM1 directory.")
|
||||
parser.add_argument("--raw-dop20-path", dest="raw_dop20_path", help="Override raw DOP20 JP2 directory.")
|
||||
parser.add_argument(
|
||||
"--use-archive",
|
||||
"--build-from-archive",
|
||||
action="store_true",
|
||||
help="Populate raw inputs from archives (unzips zips, copies dop20 filelist).",
|
||||
help="Populate raw inputs from archives (unzips zips, leaves dop20 filelist in archive).",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--setup",
|
||||
action="store_true",
|
||||
help="Create default directory structure and config if missing; still runs export unless --export is omitted.",
|
||||
help="Create default directory structure and config if missing; does not export.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--force-vrt",
|
||||
@@ -52,12 +52,15 @@ def parse_args(argv: Iterable[str] | None = None) -> argparse.Namespace:
|
||||
|
||||
|
||||
def load_config(args: argparse.Namespace) -> Config:
|
||||
if args.setup and not os.path.exists(args.config):
|
||||
cfg = ensure_default_config(args.config)
|
||||
if args.setup:
|
||||
cfg = Config.default()
|
||||
cfg.save(args.config)
|
||||
return cfg.with_overrides(raw_dgm1_path=args.raw_dgm1_path, raw_dop20_path=args.raw_dop20_path)
|
||||
if os.path.exists(args.config):
|
||||
cfg = Config.load(args.config)
|
||||
else:
|
||||
cfg = ensure_default_config(args.config) if os.path.exists(args.config) else Config.default()
|
||||
if not os.path.exists(args.config):
|
||||
cfg.save(args.config)
|
||||
cfg = Config.default()
|
||||
cfg.save(args.config)
|
||||
return cfg.with_overrides(raw_dgm1_path=args.raw_dgm1_path, raw_dop20_path=args.raw_dop20_path)
|
||||
|
||||
|
||||
@@ -68,8 +71,10 @@ def main(argv: Iterable[str] | None = None) -> int:
|
||||
if args.setup:
|
||||
ensure_directories(cfg)
|
||||
print(f"Directories ensured. Config at {args.config}.")
|
||||
if args.no_export or args.export is None:
|
||||
return 0
|
||||
|
||||
if args.use_archive:
|
||||
if args.build_from_archive:
|
||||
materialize_archives(cfg)
|
||||
|
||||
if args.no_export:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Download DOP20 assets (JP2/J2W/XML) listed line-by-line in raw/dop20/filelist.txt.
|
||||
# Download DOP20 assets (JP2/J2W/XML) listed line-by-line in archive/dop20/filelist.txt.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
|
||||
|
||||
Reference in New Issue
Block a user