Vector-based Approach
This page explains how to use DamageScanner with vector-based exposure data (e.g. shapefiles, GeoPackages, or OSM data). This approach is ideal for object-level damage estimation, such as buildings, roads, power plants, and other individual infrastructure assets.
When to Use Vector-Based Workflows
| Scenario | Raster-Based | Vector-Based |
|---|---|---|
| Infrastructure objects (e.g. bridges, roads) | ❌ | ✅ |
| OpenStreetMap data | ❌ | ✅ |
| Detailed local studies | ❌ | ✅ |
| Exposure linked to specific geometries | ❌ | ✅ |
Required Inputs
As described in the Overview, you need:
- Hazard raster (e.g. flood depth, wind speed)
- Exposure vector (e.g. buildings, roads — as
.shp,.gpkg,.pbf, orGeoDataFrame) - Vulnerability curves (CSV or DataFrame)
- Maximum damage values (CSV, dict, or DataFrame)
⚠️ Your exposure data must include a column specifying asset type, matching the keys used in the vulnerability curves and max damage data.
Minimal Working Example
from damagescanner import DamageScanner
hazard = "data/hazard_flood_depth.tif"
feature_data = "data/infrastructure_osm.gpkg"
curves = "data/vulnerability_curves.csv"
maxdam = "data/maxdam.csv"
scanner = DamageScanner(hazard, feature_data, curves, maxdam)
damage = scanner.calculate()
The result is a GeoDataFrame of features with estimated direct damage values per asset.
Key Behavior
- The exposure file must contain geometry columns (Point, LineString, or Polygon)
DamageScanneroverlays each geometry with the hazard raster- It then samples the hazard value and looks up the damage fraction from the corresponding vulnerability curve
- The damage is calculated as:
\
exposure_area * damage_fraction * max_damage
⚠️ Geometry Handling Tips
⚠️ Mixed Geometry Types — Avoid mixing Points and Polygons for the same asset type.
⚠️ CRS Alignment — Both hazard and vector data must be in the same coordinate reference system.
⚠️ Object Column — You must define a column that links each object to a vulnerability curve and max damage.
📚 See Also
API Documentation
vector
Vector-based damage estimation functions for DamageScanner.
VectorExposure(hazard_file, feature_file, asset_type='roads', object_col='object_type', hazard_value_col='band_data', disable_progress=False, gridded=True, extract_strategy='raster-sequential', return_full=True)
Load and overlay vector or raster hazard with vector exposure data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hazard_file
|
Path | Dataset | DataArray | DatasetReader | GeoDataFrame
|
Hazard input. |
required |
feature_file
|
Path | GeoDataFrame | DataFrame | str
|
Exposure input. |
required |
asset_type
|
str | None
|
Infrastructure category (only for OSM). |
'roads'
|
object_col
|
str
|
Name of the object type column. |
'object_type'
|
hazard_value_col
|
str
|
Column name in vector hazard containing intensity values. |
'band_data'
|
disable_progress
|
bool
|
Whether to suppress progress bars. |
False
|
gridded
|
bool
|
Whether to process in spatial chunks. |
True
|
extract_strategy
|
str
|
exactextract strategy - "feature-sequential" or "raster-sequential". |
'raster-sequential'
|
return_full
|
bool
|
Whether to return all features, even those with no hazard intersection. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
tuple[GeoDataFrame, str, CRS | None, float | None]
|
(features, object_col, hazard_crs, cell_area_m2) |
Raises:
| Type | Description |
|---|---|
ValueError
|
If input files are not in expected formats or if geometry types are unsupported. |
VectorScanner(hazard_file, feature_file, curve_path, maxdam_path=None, asset_type=None, multi_curves=dict(), object_col='object_type', hazard_value_col='band_data', disable_progress=False, gridded=True, extract_strategy='raster-sequential', return_full=True)
Perform vector-based direct damage assessment using hazard and exposure layers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hazard_file
|
Path | Dataset | DataArray | GeoDataFrame | str
|
Hazard input. |
required |
feature_file
|
Path | GeoDataFrame | str
|
Exposure input. |
required |
curve_path
|
Path | DataFrame | str
|
Vulnerability curve(s). |
required |
maxdam_path
|
Path | DataFrame | dict | None
|
Maximum damage values. |
None
|
asset_type
|
str | None
|
Infrastructure class (only for OSM). |
None
|
multi_curves
|
dict
|
Multiple curve sets. |
dict()
|
object_col
|
str
|
Column name with object type. |
'object_type'
|
hazard_value_col
|
str
|
Column name in vector hazard containing intensity values. |
'band_data'
|
disable_progress
|
bool
|
Whether to suppress progress bars. |
False
|
gridded
|
bool
|
Whether to process in spatial chunks. |
True
|
extract_strategy
|
str
|
exactextract strategy - "feature-sequential" or "raster-sequential". |
'raster-sequential'
|
return_full
|
bool
|
Whether to return all features, even those with no hazard intersection. |
True
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
Exposure data with calculated damages. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If input files are of unsupported formats or if geometry types are not supported. |
KeyError
|
If object types in exposure are not covered by maximum damage data. |