Skip to main content
Loading navigation

Build a CityJSON Urban Flood Inundation Assessor — implementation

Prompt source

implementation95 lines11 sectionsNo variables1 code block
## Build
Assess coastal and riverine flood vulnerabilities using CityJSON 3D terrain and building footprints. Identify ground-floor habitable spaces below projected sea level rises to plan flood defenses.

## User
Urban Resilience and Infrastructure Planner

## Workflow
1. Load a municipal CityJSON model containing Building and WaterBody objects.
2. Parse geographicalExtent bounding boxes and base elevation coordinates.
3. Simulate projected water surge levels against building ground finished elevations.
4. Generate a structured vulnerability report identifying high-risk municipal assets.

## Interface
Interactive floodplain map displaying water level contours, affected building polygons, and flood mitigation priority tables.

## Data
Download open CityJSON 2.0 city models from European municipal open geodata repositories.
Starter examples below are synthetic. They are not downloaded records.

## Source
[CityJSON](https://www.cityjson.org/specs/2.0.1/)
Reads geographicalExtent [minx, miny, minz, maxx, maxy, maxz] and WaterBody city objects from CityJSON.

## Tools
langgraph, fastapi, pydantic.
LangGraph choreographs the multi-stage evaluation pipeline between elevation extraction, surge comparison, and risk ranking.
General instruction API model to synthesize resilience recommendations from geospatial flood impact data.

## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

## Acceptance
- Extracts minz ground elevation from CityJSON building bounding boxes.
- Flags buildings where minz is lower than the projected surge height.
- Outputs risk classifications based on flood inundation depth.

## Starter Examples
```json
[
  {
    "input": {
      "surge_scenario_name": "100-Year Surge Event",
      "projected_flood_elevation_m": 4.2,
      "building": {
        "id": "Docklands_Warehouse_04",
        "type": "Building",
        "geographicalExtent": [
          85200,
          447100,
          3.1,
          85250,
          447160,
          15
        ],
        "attributes": {
          "owner": "Port Authority",
          "occupancy": "Storage"
        }
      }
    },
    "expected_output": {
      "building_id": "Docklands_Warehouse_04",
      "ground_elevation_m": 3.1,
      "flood_level_m": 4.2,
      "inundation_depth_m": 1.1,
      "risk_category": "CRITICAL",
      "mitigation_recommended": "Install deployable flood barriers and elevate ground-level electrical switchgear."
    }
  },
  {
    "input": {
      "surge_scenario_name": "100-Year Surge Event",
      "projected_flood_elevation_m": 4.2,
      "building": {
        "id": "Upland_Apartments_12",
        "type": "Building",
        "geographicalExtent": [
          86000,
          448000,
          8.5,
          86040,
          448050,
          24
        ],
        "attributes": {
          "owner": "Civic Housing",
          "occupancy": "Residential"
        }
      }
    },
    "expected_output": {
      "building_id": "Upland_Apartments_12",
      "ground_elevation_m": 8.5,
      "flood_level_m": 4.2,
      "inundation_depth_m": 0,
      "risk_category": "SAFE",
      "mitigation_recommended": "No structural floodproofing required."
    }
  }
]
```

## Safety
Surge calculations represent macro-level planning simulations. Emergency flood management must follow official civic emergency protocols.
Use mock external writes. Require human review before any real deployment.