Terrain-derived drainage and building-encroachment detection for Accra, Ghana
# accraflood
Terrain-derived drainage and building-encroachment detection for Accra, Ghana.
## The idea
Accra's flooding is pluvial: rain overwhelms drains that are clogged or paved over. The
underlying cause is governance, because buildings sit on natural watercourses. Rather than try
to map the (often undocumented) pipe network, we derive the natural drainage from terrain.
Water flow is a function of elevation, so standard hydrology on a Digital Elevation Model
recovers where water wants to go, even where a watercourse has been built over, because the
terrain still "remembers" the channel. Overlaying building footprints on those flow paths flags
encroachment. Differencing the footprints over time produces dated, geolocated records of when
each building appeared on the watercourse.
## Pipeline
```mermaid
flowchart TD
DEM["Copernicus DEM (30 m)"] --> HYD["hydrology fill, D8 accumulation, threshold"]
HYD --> STREAMS["vector stream network"]
OB["Open Buildings footprints"] --> OV["overlay buildings in channel buffers"]
STREAMS --> OV
OV --> ENC["ranked encroachers"]
OSM["OSM mapped waterways"] --> VAL["validate derived streams vs real channels"]
STREAMS --> VAL
OBT["Open Buildings Temporal (2016-2023)"] --> TMP["temporal first-appearance year"]
ENC --> TMP
TMP --> DATED["dated encroachers"]
STREAMS --> MAP["combined HTML map"]
ENC --> MAP
DATED --> MAP
VAL --> MAP
```
## Data (all free, via Google Earth Engine and OpenStreetMap)
| Need | Source | Resolution |
|---|---|---|
| Terrain | `COPERNICUS/DEM/GLO30` | 30 m |
| Buildings | `GOOGLE/Research/open-buildings/v3/polygons` | polygon |
| Buildings over time | `GOOGLE/Research/open-buildings-temporal/v1` | annual 2016-2023 |
| Independent waterways (validation) | OpenStreetMap (Overpass) | vector |
| Sentinel-1 SAR (optional, deferred) | `COPERNICUS/S1_GRD` (VV, IW) | 10 m |
## Setup
```bash
# Create the conda env (conda-forge ships prebuilt GDAL, rasterio, geopandas)
conda env create -f environment.yml
c …