Machine learning for flood risk prediction in Lagos, Nigeria using open geospatial data
# Geospatial Machine Learning for Flood Risk Mapping in Lagos, Nigeria
A reproducible geospatial machine learning project that predicts flood risk
across Lagos State, Nigeria, using open satellite data and historical flood
records. Built entirely with free, open-access datasets and standard laptop
computing resources.
## Research Question
To what extent can machine learning models, trained on topographic,
hydrological, and land-cover-derived geospatial variables, distinguish
flood-prone from non-flood-prone areas in Lagos, and which environmental
factors contribute most to elevated flood risk?
## Motivation
Flooding is a major recurring hazard in Lagos, driven by its low-lying
coastal topography, extensive lagoon system, and intense seasonal rainfall.
This project explores whether a data-driven, machine learning approach —
using only free, open satellite data — can produce a credible, interpretable
flood risk assessment as a reproducible complement to traditional flood
hazard mapping.
## Study Area
Lagos State, Nigeria — selected for its well-documented flood history,
strong open-data coverage via Google Earth Engine, and low-lying coastal
geography that makes it a scientifically meaningful case study.
## Data
| Variable | Source | Resolution |
|---|---|---|
| Elevation | SRTM 30m DEM (USGS) | 30m |
| Slope | Derived from SRTM | 30m |
| Rainfall (2023 annual) | CHIRPS Daily (UCSB) | ~5km |
| NDVI | Sentinel-2 (ESA Copernicus) | 40m |
| NDWI | Sentinel-2 (ESA Copernicus) | 40m |
| Land cover | ESA WorldCover v200 | 40m |
| Flood occurrence (target) | Global Flood Database (Tellman et al., 2021, *Nature*) | 40m |
All data acquired programmatically via the Google Earth Engine Python API.
## Methodology
1. Acquired and clipped all layers to the Lagos boundary via Earth Engine
2. Resampled all predictors onto a common 40m grid
3. Built a full feature table (4,263,810 pixels; ~10% historically flooded)
4. Stratified subsample (80,000 pixels) for laptop-friendl …