# Ground Zero Terrain Import Prototype

## Purpose

This prototype proves that the selected Ground Zero tile can be sampled from
real elevation data and converted into files Unreal can import or inspect.

It is not the final terrain pipeline. The final pipeline should use raster DEM
or lidar-derived terrain data at higher resolution. This first pass is useful
because it validates tile coordinates, source access, height normalization, and
metadata recording.

## Script

```text
Scripts/prototype_ground_zero_terrain.py
```

The script:

- Reads the Ground Zero tile from `Data/Tiles/ground_zero_tiles.json`.
- Converts UTM sample points to latitude/longitude.
- Queries the USGS Elevation Point Query Service in meters.
- Writes CSV elevation samples.
- Writes a little-endian unsigned `.r16` prototype heightmap.
- Writes terrain generation metadata.
- Marks the Ground Zero tile as `generated` in the tile registry seed.

## Default Output

```text
Data/Terrain/Generated/gz_us_ca_pacifica_utm10n_e544_n4160/
```

Expected files:

- `gz_us_ca_pacifica_utm10n_e544_n4160_elevation_samples_33.csv`
- `gz_us_ca_pacifica_utm10n_e544_n4160_heightmap_33.r16`
- `gz_us_ca_pacifica_utm10n_e544_n4160_terrain_metadata.json`

## Run

```bash
python3 Scripts/prototype_ground_zero_terrain.py
```

Optional:

```bash
python3 Scripts/prototype_ground_zero_terrain.py --grid-size 65 --workers 8
```

## Import Notes

- The `.r16` file is normalized from the sampled minimum elevation to sampled
  maximum elevation.
- Use the generated metadata file to recover the real elevation range.
- Horizontal tile scale is 1000 m x 1000 m.
- The default 33 x 33 grid is intentionally small for a fast proof of concept.
- Final landscape import should use a valid Unreal Landscape resolution and a
  higher-resolution DEM/lidar source.

## Current Source

Primary prototype source:

```text
USGS Elevation Point Query Service
https://epqs.nationalmap.gov/v1/json
```

The service is backed by USGS elevation data and returns point elevations in
meters for latitude/longitude coordinates.
