| .. | ||
| packages | ||
| src | ||
| tests | ||
| .gitignore | ||
| CMakeLists.txt | ||
| CMakePresets.json | ||
| README.md | ||
| vcpkg.json | ||
gadm-boundaries
Native C++ boundaries batch generator for the GADM pipeline.
Uses GDAL/GEOS/PROJ for 10–100× speedup over the TypeScript pipeline on geometry union + GHS raster enrichment.
Prerequisites
| Tool | Version |
|---|---|
| CMake | ≥ 3.20 |
| C++ compiler | C++20 (MSVC, GCC, or Clang) |
| vcpkg | Latest (set VCPKG_ROOT env var) |
Setup
# Install native dependencies (one-time)
vcpkg install
Build
# Release (Ninja)
cmake --preset vcpkg
cmake --build build --config Release
# Windows MSVC
cmake --preset vcpkg-win
cmake --build build --config Release
# Debug
cmake --preset dev
cmake --build build/dev
Usage
# All countries, all levels
./build/boundaries --country=all
# Single country, specific level
./build/boundaries --country=DEU --level=0
# Force regeneration (ignore cache)
./build/boundaries --country=NGA --force
Output goes to cache/gadm/boundary_{code}_{level}.json — drop-in replacement for the TS pipeline.
Architecture
See docs/cpp-port.md for the full spec.
src/
├── main.cpp # CLI entry, country loop, cache logic
├── gpkg_reader.h/cpp # GeoPackage → features (OGR)
├── geo_merge.h/cpp # Geometry union (GEOS)
├── ghs_enrich.h/cpp # GeoTIFF raster sampling + PIP
├── pip.h # Inline ray-casting point-in-polygon
└── types.h # BoundaryFeature, BoundaryResult structs