Skip to main content

Flood detection and damage assessment using Sentinel-1 SAR and OSM data with Google Earth Engine

Project description

🌊 FloodRisk

PyPI License DOI


📌 Overview

FloodRisk is a Python package for flood detection and damage assessment using:

  • Sentinel-1 SAR imagery (via Google Earth Engine)
  • Otsu thresholding for flood extent mapping
  • OpenStreetMap (OSM) data for infrastructure damage analysis
  • CSV & GeoTIFF export
  • Visualization of flood extent and results

✅ Key Features

✔ Flood inundation mapping with Sentinel-1 SAR ✔ Automatic thresholding using Otsu method ✔ Compute inundation percentage and area statistics ✔ Damage assessment for roads and buildings using OSM data ✔ Export results (CSV, GeoTIFF) ✔ Visualization of flood maps


🔍 Installation

Install from PyPI:

pip install floodrisk

From source:

git clone https://github.com/MeawMan/floodrisk.git
cd floodrisk
pip install -e .

🚀 Quick Start

1. Initialize Google Earth Engine

from floodrisk import initialize

# Authenticate GEE
initialize(project_id="your-project-id")

2. Detect Flood (Sentinel-1 via GEE)

from floodrisk import detect_flood, export_map

# Detect flood inundation
result = detect_flood(
    aoi_name="Feni",
    before_start="2025-01-01", before_end="2025-01-31",
    after_start="2025-07-01", after_end="2025-07-12"
)

print("Flooded Area (ha):", result['Flooded Area (ha)'].getInfo())

# Export flood map to Google Drive
export_map(result['flooded_image'], "Flood_Extent", "GEE_Flood")

3. Damage Assessment

from shapely.geometry import Polygon
from floodrisk import download_osm_data, compute_flood_damage, export_csv

# Define AOI polygon
aoi_polygon = Polygon([(91.15, 23.40), (91.20, 23.40), (91.20, 23.45), (91.15, 23.45)])

# Download OSM roads & buildings
roads, buildings = download_osm_data(aoi_polygon)

# Flood raster (GeoTIFF from GEE export)
flood_tif_path = "Flood_Extent.tif"

# Compute flood damage
damage_result = compute_flood_damage(roads, buildings, flood_tif_path)

print(damage_result['road_stats'])
print(damage_result['building_stats'])

# Export results as CSV
export_csv(damage_result['road_stats'], damage_result['building_stats'], "output/reports")

4. Visualization

from floodrisk import visualize_map

visualize_map("Flood_Extent.tif", aoi_shapefile="aoi.shp")

✅ Output Example

AOI: Feni
Otsu Threshold: 1.21
Total Area: 88,029 ha
Flooded Area: 18,647 ha
Inundation: 21%
Road Damage Summary:
Category           Total Length (km)  Flooded Length (km)  Flooded %
National Highways             207.05                 4.03       1.94
Regional Roads                322.97                14.40       4.46
Local Roads                  1909.71               111.38       5.83

Building Damage Summary:
{'Total Buildings': 161204, 'Flooded Buildings': 5242, 'Flooded %': 3.25}

✅ CLI Usage

Run from terminal:

floodrisk --aoi Feni --before_start 2025-01-01 --before_end 2025-01-31 --after_start 2025-07-01 --after_end 2025-07-12 --flood_raster Flood_Extent.tif --output results --visualize

📜 Citation

Rahman, M.R. (2025). FloodRisk: A Python Package for Flood Detection and Damage Assessment.
Zenodo. https://doi.org/10.5281/zenodo.16407193

✅ License

MIT License. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

floodrisk-1.0.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

floodrisk-1.0.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file floodrisk-1.0.0.tar.gz.

File metadata

  • Download URL: floodrisk-1.0.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for floodrisk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 732b9795e656016b878711837bf7a3dd2a274a8ea17bd34c1606b447fc86984d
MD5 b924628269315c8cc71300f0c6e32603
BLAKE2b-256 6ea734e7ea87e349f6ca30890d2c468670b35ff77c962da30faecee907ba0c8a

See more details on using hashes here.

File details

Details for the file floodrisk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: floodrisk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for floodrisk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2c7a627dea82835e36cb597569896157e9ab75526358cf18f04ce79c0613fe5
MD5 10b6790bd3bcb2dcc0cd4db2eb5078c7
BLAKE2b-256 6d2ca0a85e3926b7a61cb4c6a1781b21a595393b7fd6ef799dc9832f8ad6698d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page