Generate detailed 3D models of UNESCO World Heritage Sites and Biosphere Reserves using Google Earth Engine and VoxCity 1.6 โ quality-gated and published to Hugging Face
Complete Wiki & Guides | Quick Start | Parameter Tuning
Fetch the full UNESCO catalogs, batch-generate quality-gated 3D models, and publish to a private Hugging Face dataset:
# 1. Fetch site catalogs (WHC whc001 + MAB mab001 โ data/sites.csv, ~2,040 sites)
poetry run python unesco_data.py
# 2. Batch generate (pilot: 5 WHC + 5 MAB, premium quality, resume-safe)
poetry run python batch.py --pilot
# 3. Upload quality-passed models to HF (HF_TOKEN with write access)
export HF_TOKEN=hf_...
export HF_DATASET_REPO=your-username/heritage-3d-models
poetry run python upload_hf.py # add --dry-run to previewEvery generated site is checked by an automated quality gate (quality_gate.py):
models with degenerate geometry, missing terrain, or missing buildings (for
Cultural/Mixed sites) are failed and never uploaded; models built from
degraded fallback data sources are flagged for manual review.
Each site directory contains model.obj/model.mtl (voxel), model.glb
(web-friendly voxel, Y-up, colored), model_smooth.glb (non-voxel hybrid:
triangulated DEM terrain + LOD1 building prisms), a preview.png for visual
inspection, metadata.json (provenance + generation config), quality.json
(metrics + status), and the analysis layers described below.
Every model is more than a render: it ships with environmental simulation
layers computed on the voxel grid (analysis.py, on by default โ skip with
--no-analysis):
| Layer | Files | What it tells you |
|---|---|---|
| โ๏ธ Solar irradiance (solstice noon) | solar_solstice_noon.png/.npz |
Instantaneous sun exposure (W/mยฒ), Jun 21 12:00 |
| ๐ Solar irradiance (solstice day) | solar_solstice_day.png/.npz |
Cumulative daily exposure (Wh/mยฒยทday), Jun 21 |
| ๐ณ Green View Index | green_index.png/.npz |
Vegetation visible at pedestrian level (0โ1) |
| ๐ค๏ธ Sky View Index | sky_index.png/.npz |
Sky openness from the ground (0โ1) |
Solar layers use the nearest EPW weather file (auto-downloaded); view
indices use a 1.5 m viewpoint height. PNGs are ready-made maps with colorbars;
.npz files hold the raw grids for your own analysis:
import numpy as np
solar = np.load("output/whc/252_taj_mahal/solar_solstice_day.npz")["grid"]Use cases: โ๏ธ solar-panel potential & heat-stress hotspots, ๐ณ greenery/wellbeing assessment, ๐ค๏ธ canyon-effect & daylight studies, ๐ก๏ธ microclimate pre-screening for ENVI-met runs.
To (re)compute analysis layers for already-generated sites without re-generating the models:
poetry run python backfill_analysis.pyPrerequisite: Earth Engine authentication (poetry run earthengine authenticate,
project ID via EE_PROJECT_ID in .env โ copy .env.example and set your own
GEE project id; .env is git-ignored).
submit_hf_job.sh runs the whole pipeline on HF Jobs infrastructure (code
bundle โ batch โ upload, EE credentials passed as job secrets). All account-
specific values are environment-driven โ see the header of the script:
HF_TOKEN, HF_DATASET_REPO, EE_PROJECT_ID, optional HF_JOB_NAMESPACE
(org billing). Note: HF Jobs is pay-as-you-go.
Choose from 4 optimized quality levels for different use cases:
| Quality | Coverage | Detail | Time | Use Case |
|---|---|---|---|---|
| ๐ PREVIEW | 0.25 kmยฒ | 10m voxels | 30-60s | Quick location testing |
| โ๏ธ STANDARD | 0.56 kmยฒ | 5m voxels | 2-4 min | General documentation |
| ๐ PREMIUM | 1.0 kmยฒ | 3m voxels | 8-15 min | Important heritage sites |
| ๐ ULTIMATE | 1.44 kmยฒ | 2m voxels | 20-45 min | Critical preservation |
# 1. Install dependencies
poetry install --no-root
# 2. Setup with quality presets (interactive)
poetry run python setup.py
# 3. Generate your first model
poetry run python main.py test# Interactive mode with quality selection
poetry run python main.py
# Quick test (Mont-Saint-Michel)
poetry run python main.py test
# Specific site by key (whc:<id_no> or mab:<mab_id>)
poetry run python main.py whc:274 # Machu Picchu
poetry run python main.py mab:USYe1976 # Yellowstone - Grand Teton# Use specific quality preset
poetry run python main.py --quality preview # Fast preview
poetry run python main.py --quality standard # Balanced (default)
poetry run python main.py --quality premium # High quality
poetry run python main.py --quality ultimate # Maximum quality
# Site + Quality combination
poetry run python main.py whc:274 --quality ultimate # Machu Picchu in max quality# List available quality presets
poetry run python main.py --list-quality
# Show detailed preset information
poetry run python main.py --quality-details premium
# Quality system CLI
poetry run python quality_config.py# Interactive setup with quality preset selection
poetry run python setup.py
# Or apply specific preset directly
poetry run python setup.py --preset standard
# Validate installation
poetry run python setup.py --validatepoetry run earthengine authenticate
poetry run earthengine set_project <your-gee-project-id>heritage-3d-generator/
โโโ main.py # ๐ฏ Single-site CLI (site key, row number, or 'test')
โโโ pipeline.py # ๐๏ธ Shared generation core (VoxCity 1.6, fallback chain)
โโโ analysis.py # โ๏ธ Solar irradiance + Green/Sky View Index layers
โโโ backfill_analysis.py # ๐ Recompute analysis layers for existing sites
โโโ batch.py # ๐ฆ Batch runner (pilot / selected / all, resume-safe)
โโโ quality_gate.py # ๐ฏ Quality metrics, pass/flag/fail, preview PNG
โโโ smooth_export.py # ๐๏ธ Smooth GLB export (DEM terrain + LOD1 buildings)
โโโ regen_smooth.py # ๐ Re-export smooth GLBs after exporter improvements
โโโ upload_hf.py # ๐ค Publish passed models + dataset card to HF
โโโ unesco_data.py # ๐ Fetch whc001 + mab001 catalogs (Huwise API)
โโโ submit_hf_job.sh # โ๏ธ Run the pipeline on HF Jobs (optional)
โโโ quality_config.py # ๐ฏ Quality configuration system
โโโ setup.py # ๐ ๏ธ Setup and validation script
โโโ data/
โ โโโ unesco_heritage_sites.csv # ๐๏ธ Legacy 10-site database
โ โโโ sites.csv # ๐ Normalized catalog (generated, git-ignored)
โโโ output/ # ๐ Per-site dirs: OBJ/GLB/smooth GLB, preview, metadata
โโโ wiki/ # ๐ Complete documentation
โโโ .env.example # โ๏ธ Config template (copy to git-ignored .env)
โโโ pyproject.toml # ๐ฆ Poetry dependencies
- Purpose: Quick location testing, site exploration
- Coverage: 500m ร 500m (0.25 kmยฒ)
- Resolution: 10m voxels (2,500 total)
- Time: 30-60 seconds
- Data Sources: Basic OpenStreetMap + FABDEM
- Purpose: General UNESCO documentation, presentations
- Coverage: 750m ร 750m (0.56 kmยฒ)
- Resolution: 5m voxels (22,500 total)
- Time: 2-4 minutes
- Data Sources: OpenStreetMap + ETH Canopy + FABDEM
- Purpose: Important heritage site documentation, research
- Coverage: 1000m ร 1000m (1.0 kmยฒ)
- Resolution: 3m voxels (111,111 total)
- Time: 8-15 minutes
- Data Sources: OSM + ESRI Land Cover + High-res Canopy + FABDEM
- Purpose: Critical heritage preservation, academic research
- Coverage: 1200m ร 1200m (1.44 kmยฒ)
- Resolution: 2m voxels (360,000 total)
- Time: 20-45 minutes
- Data Sources: Microsoft Buildings + ESRI + High-res Canopy + DeltaDTM
- 3D Viewer: https://3dviewer.net/ (drag & drop .obj file)
- Sketchfab: Upload for sharing and embedding
- macOS:
open output/Site_Name.obj - Blender: File > Import > Wavefront (.obj)
- Rhino: Professional 3D modeling
- MagicaVoxel: Voxel editing and visualization
output/<programme>/<site>/
โโโ model.obj / model.mtl # 3D model geometry (voxel)
โโโ model.glb # Web-friendly voxel GLB (Y-up, colored)
โโโ model_smooth.glb # Smooth hybrid: DEM terrain + LOD1 buildings
โโโ preview.png # 3D render for quick inspection
โโโ solar_solstice_noon.png/.npz # โ๏ธ Instantaneous irradiance (W/mยฒ)
โโโ solar_solstice_day.png/.npz # โ๏ธ Cumulative daily irradiance (Wh/mยฒยทday)
โโโ green_index.png/.npz # ๐ณ Green View Index (0โ1)
โโโ sky_index.png/.npz # ๐ค๏ธ Sky View Index (0โ1)
โโโ metadata.json # Provenance + generation config
โโโ quality.json # Quality-gate metrics + status
โโโ voxcity.INX # ENVI-MET simulation file (opt-in --envimet)
| ID | Site | Country | Type | Year |
|---|---|---|---|---|
| 0 | Galรกpagos Islands | ๐ช๐จ Ecuador | Natural | 1978 |
| 1 | Mont-Saint-Michel and its Bay | ๐ซ๐ท France | Cultural | 1979 |
| 2 | Palace and Park of Versailles | ๐ซ๐ท France | Cultural | 1979 |
| 3 | Historic Sanctuary of Machu Picchu | ๐ต๐ช Peru | Mixed | 1983 |
| 4 | Petra | ๐ฏ๐ด Jordan | Cultural | 1985 |
| 5 | Angkor | ๐ฐ๐ญ Cambodia | Cultural | 1992 |
| 6 | Taj Mahal | ๐ฎ๐ณ India | Cultural | 1983 |
| 7 | Historic Centre of Rome | ๐ฎ๐น Italy | Cultural | 1980 |
| 8 | Yellowstone National Park | ๐บ๐ธ USA | Natural | 1978 |
| 9 | Memphis and its Necropolis | ๐ช๐ฌ Egypt | Cultural | 1979 |
# Zone parameters
ZONE_SIZE_METERS=750 # Coverage area (500-1200m)
MESH_SIZE_METERS=5 # Voxel size (2-10m)
# Data sources (quality hierarchy)
BUILDING_SOURCE=OpenStreetMap # or Microsoft Building Footprints
LAND_COVER_SOURCE=OpenStreetMap # or ESRI Land Cover
CANOPY_HEIGHT_SOURCE=ETH Global Sentinel-2 10m # or High Resolution 1m Global
DEM_SOURCE=FABDEM # or DeltaDTM
DEM_INTERPOLATION=true # Enhanced terrain processingCreate your own quality preset by modifying quality_config.py:
custom = QualityConfig(
name="CUSTOM",
description="๐ฏ Your custom configuration",
zone_size=800, # Custom coverage
mesh_size=4, # Custom resolution
# ... other parameters
)-
Earth Engine Authentication:
poetry run earthengine authenticate poetry run earthengine set_project <your-gee-project-id>
-
Quality System Not Available:
- Ensure
quality_config.pyexists - Run
poetry run python setup.py --validate
- Ensure
-
Generation Failures:
- Try lower quality preset:
--quality preview - Check Earth Engine quotas
- Verify internet connection
- Try lower quality preset:
-
Performance Issues:
- Use PREVIEW preset for testing
- Reduce zone size in .env
- Increase mesh size for faster generation
| Quality | Voxels | File Size | RAM Usage | Recommended For |
|---|---|---|---|---|
| PREVIEW | 2.5K | ~1MB | Low | Testing, exploration |
| STANDARD | 22.5K | ~5MB | Medium | Documentation, sharing |
| PREMIUM | 111K | ~15MB | High | Research, analysis |
| ULTIMATE | 360K | ~50MB | Very High | Archive, critical work |
This repo is safe for public release by design:
- No credentials in the repo โ
HF_TOKEN,EE_PROJECT_ID,HF_DATASET_REPOare read from the environment /.env(git-ignored; use.env.exampleas template) - Earth Engine credentials stay in
~/.config/earthengine/and are only ever passed as HF Job secrets at submit time (never written to the repo) .gitignorecovers.env, outputs, caches, fetched catalogs, secret-file patterns, and journal PDFs (copyright)- UNESCO site coordinates come from the public data.unesco.org API โ no internal endpoints anywhere
This project supports UNESCO's mission of World Heritage preservation through digital documentation.
# Clone and setup
git clone https://github.com/unesco/heritage-3d-generator.git
cd heritage-3d-generator
poetry install --no-root
# Test changes
poetry run python setup.py --validate
poetry run python main.py test --quality preview- Add coordinates to
data/unesco_heritage_sites.csv - Test with PREVIEW quality first
- Update documentation
- VoxCity Version: 1.6.2 (new object-based API:
get_voxcity()returns aVoxCitydataclass) - Python: 3.12+
- Dependencies: Rich, Pandas, Earth Engine API, Tenacity, Hugging Face Hub, Requests
- Export Formats: OBJ (+MTL), GLB (voxel + smooth hybrid), ENVI-MET (INX, opt-in via
--envimet) - Analysis Layers: solar irradiance (EPW-based), Green/Sky View Index (PNG + raw
.npz) - Data Sources: OpenStreetMap, Google Earth Engine, ESRI, Microsoft
- Site Catalogs: UNESCO data.unesco.org (Huwise API) โ whc001 (1,244 sites) + mab001 (797 sites)
- Quality Gate: automated metrics + pass/flag/fail before any HF publication
- Fallback Logic: 7-strategy automatic source switching on failures
- โ Quality Preset System: 4 optimized configurations
- โ Analysis Layers: solar irradiance, Green/Sky View Index out of the box
- โ Interactive UI: Rich console with progress bars
- โ Robust Generation: Automatic fallback on failures
- โ Multiple Exports: OBJ, GLB (voxel + smooth), ENVI-MET, colored models
- โ Heritage Catalog: 2,000+ sites from UNESCO open data (whc001 + mab001)
- โ Quality Gate: automated pass/flag/fail before any publication
- โ Easy Setup: Automated configuration and validation
This project is licensed under the MIT License.
Generated with โค๏ธ for UNESCO World Heritage preservation by the UNESCO Data & AI Team
๐ฏ Ready to create your first 3D heritage model?
poetry run python main.py --quality standard