> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nikaplanet.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Flood Risk Data LULC In Urban Areas

> Prepare core geospatial layers for analyzing flood-prone areas in Bangkok using elevation, land cover, and rainfall data

# Flood Risk Data LULC In Urban Areas

<img src="https://mintcdn.com/nika/KF-c86_3b0KWdTjW/industrial-solutions/flood-risk-data-lulc-urban-areas-1.jpeg?fit=max&auto=format&n=KF-c86_3b0KWdTjW&q=85&s=cff1ec6b2c275983c19ba773d72b3cf6" alt="Flood Risk Data LULC In Urban Areas" width="999" height="513" data-path="industrial-solutions/flood-risk-data-lulc-urban-areas-1.jpeg" />

This script prepares core geospatial layers for analyzing flood-prone areas in Bangkok. It exports elevation, land cover (water and built-up areas), and October 2023 rainfall data to local GeoTIFF files using Google Earth Engine and geemap. The outputs are used for flood vulnerability analysis, especially in low-lying, urbanized zones.

## Output File

`/data/bangkok_flood_native`

## Requirements

| Requirement         | Details                                                                                                              |
| ------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **Software**        | Python 3.x, Earth Engine Python API, geemap                                                                          |
| **Earth Engine**    | Enabled Google Earth Engine account ([https://signup.earthengine.google.com](https://signup.earthengine.google.com)) |
| **Python Packages** | geemap, earthengine-api, os, ee                                                                                      |
| **Internet**        | Required for Earth Engine data download                                                                              |

## Files Created

| Filename                          | Description                                   | Resolution |
| --------------------------------- | --------------------------------------------- | ---------- |
| **dem\_srtm.tif**                 | Elevation data from SRTM (clipped to AOI)     | 30 m       |
| **dw\_water\_built\_mask.tif**    | Masked Dynamic World image (1=Water, 2=Built) | 10 m       |
| **rainfall\_oct2023\_chirps.tif** | CHIRPS total rainfall for Oct 2023            | \~5.5 km   |

## High-Level Workflow Steps

### 1. Setup and Define AOI

Define Bangkok's location and buffer by 10 km to create an Area of Interest (AOI).

### 2. Export SRTM Elevation

* Use the **USGS/SRTMGL1\_003** dataset
* Export as `dem_srtm.tif` at 30 m resolution

### 3. Export Landcover (Water & Built)

* Use the **Google Dynamic World** dataset for 2023
* Use `.mode()` to get the most frequent class
* Remap values: 0 → Water (1), 6 → Built (2), others → 0
* Export as `dw_water_built_mask.tif` at 10 m resolution

### 4. Export Rainfall

* Use **CHIRPS Daily** rainfall dataset
* Sum rainfall for October 2023
* Export as `rainfall_oct2023_chirps.tif` at \~5.5 km resolution

## Flood Risk Classification

This script generates a flood risk classification map of Bangkok using:

* **SRTM DEM (Elevation at 30m)** to identify low-lying areas (\< 5 meters elevation)
* **Dynamic World Landcover (10m)** to locate built-up and water regions

### Output: Flood-Prone Map

You get a matplotlib map showing flood-prone areas based on both elevation and landcover:

#### Legend Explained

| Color       | Label              | Meaning                                                      |
| ----------- | ------------------ | ------------------------------------------------------------ |
| 🔵 **Blue** | Low-lying Water    | Areas classified as water in DW and below 5 meters elevation |
| 🔴 **Red**  | Low-lying Built-up | Areas classified as built-up and below 5 meters elevation    |

***

<div className="solution-cta">
  <div className="solution-cta-content">
    <h3>🚀 Ready to implement this solution?</h3>
    <p>Access the complete code, step-by-step instructions, and interactive notebook in Nika Hub.</p>

    <a href="https://planet.nika.eco/en/hub/solutions/805c0468-273d-402c-8b0e-774835236df2" target="_blank" className="solution-button">
      View Full Solution →
    </a>
  </div>
</div>

<style jsx>
  {`
    .solution-cta {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      border-radius: 12px;
      padding: 2rem;
      margin: 2rem 0;
      color: white;
      text-align: center;
      box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    }

    .solution-cta-content h3 {
      margin: 0 0 0.5rem 0;
      font-size: 1.5rem;
      font-weight: 600;
    }

    .solution-cta-content p {
      margin: 0 0 1.5rem 0;
      opacity: 0.9;
      font-size: 1.1rem;
    }

    .solution-button {
      display: inline-block;
      background: rgba(255, 255, 255, 0.2);
      color: white;
      padding: 12px 24px;
      border-radius: 8px;
      text-decoration: none;
      font-weight: 600;
      font-size: 1.1rem;
      border: 2px solid rgba(255, 255, 255, 0.3);
      transition: all 0.3s ease;
      backdrop-filter: blur(10px);
    }

    .solution-button:hover {
      background: rgba(255, 255, 255, 0.3);
      border-color: rgba(255, 255, 255, 0.5);
      transform: translateY(-2px);
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    }
    `}
</style>
