Flood Analysis of Kurla region (Ctrl + Click to open in a new tab)
This project builds a building-level flood vulnerability analysis for Kurla (Mumbai) using:
- OpenStreetMap (OSM) vector features (buildings, waterways)
- DEM raster elevation data (
kurla.tif) - Feature engineering (elevation, distance metrics, terrain, hydrology)
- Unsupervised clustering (K-Means)
- Static and interactive map outputs
- GeoPackage/CSV exports for GIS tools (QGIS)
The main workflow is in the notebook:
flood.ipynb
flood.ipynb- Main notebook containing the full pipelinekurla.tif- DEM used for elevation and terrain featuresthane_dem.tif- Additional DEM available in folderinteractive_flood_map.html- Base interactive mapinteractive_flood_map_enhanced.html- Enhanced interactive map with more featuresflood_vulnerability_map.png- Static vulnerability mapflood_vulnerability_data.gpkg- Base geospatial exportflood_vulnerability_data_enhanced.gpkg- Enhanced geospatial exportflood_vulnerability_feature_report.csv- Tabular feature exportcache/- OSM/network cache artifacts
elevation- Mean building elevation from DEM zonal statsdist_to_river- Distance from each building to nearest waterway
slope_deg- DEM slope at representative building locationlocal_relief_m- Local elevation range near each building
dist_to_major_waterway- Distance to major waterwayswaterway_density_300m- Waterway length density within 300 m neighborhooddist_to_drainage_m- Distance to nearest drainage-like feature (drain,ditch,canal)
- Model: K-Means clustering (
n_clusters=3) - Input features (base model):
elevation,dist_to_river - Cluster labels are mapped to risk classes:
- High Risk
- Medium Risk
- Low Risk
Because K-Means is unsupervised, use clustering metrics (not supervised accuracy unless ground truth labels exist):
- Silhouette score
- Davies-Bouldin index
- Calinski-Harabasz score
Example with conda:
conda create -n geo_env python=3.10 -y
conda activate geo_envpip install geopandas osmnx rasterio rasterstats pandas scikit-learn matplotlib folium shapely pyprojOptional:
pip install geopyOpen flood.ipynb and run cells in sequence.
Recommended execution order:
- Install/import cells
- OSM fetch + DEM load
- Feature engineering (
elevation,dist_to_river) - K-Means clustering + risk mapping
- Base static and interactive map export
- Step 8A (terrain features)
- Step 8B (hydrology features)
- Step 10 (nearest drainage feature)
- Step 9 (enhanced output export)
Note:
- Run Step 10 before Step 9 if you want
dist_to_drainage_mincluded in enhanced exports.
After successful run, key outputs are:
flood_vulnerability_map.pnginteractive_flood_map.htmlinteractive_flood_map_enhanced.htmlflood_vulnerability_data.gpkgflood_vulnerability_data_enhanced.gpkgflood_vulnerability_feature_report.csv
- Open QGIS
- Drag and drop:
flood_vulnerability_data.gpkg(base)- or
flood_vulnerability_data_enhanced.gpkg(recommended)
- Style by
risk_level - Use numeric columns for symbology/analysis:
elevationdist_to_riverdist_to_major_waterwaywaterway_density_300mdist_to_drainage_m
If you see messages like missing buildings_with_features, dem_array, or affine:
- Re-run earlier pipeline cells (through clustering/feature creation), or
- Ensure required files exist in folder (
kurla.tif,flood_vulnerability_data.gpkg)
- Try increasing search radius in point-based fetch
- Use fallback logic already included in notebook
- Confirm internet connectivity
- Ensure metric CRS conversion is done before distance calculations
- Re-run Step 8A and Step 8B in order
- Use debug cell in notebook to check vector/DEM bounds and CRS
- Confirm
kurla.tifcovers target area
- Include rainfall intensity grids and drainage network quality as features
- Move from unsupervised clustering to supervised classification when labeled flood events are available
- Add model comparison and automated report generation
- OSM data is sourced via OSMnx and subject to OSM/OpenStreetMap data terms.
- DEM source/license depends on where
kurla.tifwas obtained.

