## Introduction
Flooding is a recurring natural disaster that poses significant risks to lives, livelihoods, and infrastructure, especially in flood-prone regions of Kenya such as Garissa, Kilifi, and Tana River counties. Understanding the spatial extent and frequency of floods in these areas is for disaster risk reduction, policy-making, and community preparedness.
This report analyzes the flood hazard extent data for **Garissa**, **Kilifi**, and **Tana River** counties for the years 2018, 2019, and 2023. The data is in vector format and was merged from various sources, including UNOSAT. The findings will contribute to identifying vulnerable areas, guiding flood mitigation strategies, and informing future resilience-building initiatives.
The objectives of this analysis are:
-To visualize the flood extent over time in Garissa, Kilifi, and Tana River counties.
-To identify trends and patterns in flood occurrence and severity during the 2018–2023 period.
-To provide insights into how these patterns could inform disaster preparedness and risk management efforts.
-This report will serve as a tool for decision-makers, local authorities, and other stakeholders working toward mitigating flood risks and enhancing climate resilience in Kenya's coastal and arid regions.
The outline is as follows:
-Introduction – Brief description of the dataset and its source.
-Data Loading – Code to load and view the dataset.
-Data Visualization – Mapping the flood extent.
-Exploratory Data Analysis – Insights, summaries, and answers to specific questions.
-Conclusions – Summary of findings.
# Load the shapefile
flood_data <- st_read("/Users/elvir/OneDrive/Desktop/RProjects/TanariverFloods/floodextent01/FloodExtent01.shp")
## Reading layer `FloodExtent01' from data source
## `C:\Users\elvir\OneDrive\Desktop\RProjects\TanariverFloods\floodextent01\FloodExtent01.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 23 features and 14 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 38.5286 ymin: -3.872603 xmax: 41.05626 ymax: 0.9863828
## Geodetic CRS: WGS 84
# View the first few rows of the data
head(flood_data)
# Summary of the dataset
summary(flood_data)
## Water_Clas Sensor_ID Sensor_Dat Confidence
## Min. :1.000 Min. :42.00 Min. :2018-05-04 Min. :0.000
## 1st Qu.:1.000 1st Qu.:42.00 1st Qu.:2018-05-04 1st Qu.:2.000
## Median :1.000 Median :42.00 Median :2018-05-04 Median :2.000
## Mean :1.087 Mean :42.17 Mean :2018-08-13 Mean :1.913
## 3rd Qu.:1.000 3rd Qu.:42.00 3rd Qu.:2018-05-04 3rd Qu.:2.000
## Max. :2.000 Max. :44.00 Max. :2023-03-26 Max. :2.000
## Field_Vali Water_Stat Notes Area_m2
## Min. :0 Min. :0.0000 Length:23 Min. : 8541
## 1st Qu.:0 1st Qu.:1.0000 Class :character 1st Qu.: 691653
## Median :0 Median :1.0000 Mode :character Median : 14103620
## Mean :0 Mean :0.9565 Mean : 58785913
## 3rd Qu.:0 3rd Qu.:1.0000 3rd Qu.: 90822224
## Max. :0 Max. :1.0000 Max. :263335713
## Area_ha SenorID_ol StaffID EventCode
## Min. : 0.854 Min. :0 Min. :121.0 Length:23
## 1st Qu.: 69.165 1st Qu.:0 1st Qu.:121.0 Class :character
## Median : 1410.362 Median :0 Median :121.0 Mode :character
## Mean : 5878.591 Mean :0 Mean :129.3
## 3rd Qu.: 9082.222 3rd Qu.:0 3rd Qu.:121.0
## Max. :26333.571 Max. :0 Max. :221.0
## Shape_Leng Shape_Area geometry
## Min. : 0.00038 Min. :6.000e-09 MULTIPOLYGON :23
## 1st Qu.: 0.13742 1st Qu.:2.368e-05 epsg:4326 : 0
## Median : 1.25799 Median :3.384e-04 +proj=long...: 0
## Mean : 9.31818 Mean :3.464e-03
## 3rd Qu.:10.54815 3rd Qu.:4.042e-03
## Max. :46.29957 Max. :1.889e-02
# Number of features
nrow(flood_data)
## [1] 23
# Bounding box of the dataset
st_bbox(flood_data)
## xmin ymin xmax ymax
## 38.5286031 -3.8726029 41.0562588 0.9863828
The map below visualizes the flood extent across Garissa, Kilifi, and Tana River counties over the period 2018, 2019, and 2023.
# Simple plot of the flood extent
plot(flood_data["geometry"], main = "Flood Extent in Garissa, Kilifi, and Tana River (2018-2023)")
# Make geometries valid
flood_data <- st_make_valid(flood_data)
# Calculate the total flood area (in square meters) for each county
flood_data$area <- st_area(flood_data)
# Check column names in the dataset
colnames(flood_data)
## [1] "Water_Clas" "Sensor_ID" "Sensor_Dat" "Confidence" "Field_Vali"
## [6] "Water_Stat" "Notes" "Area_m2" "Area_ha" "SenorID_ol"
## [11] "StaffID" "EventCode" "Shape_Leng" "Shape_Area" "geometry"
## [16] "area"
# Summarize the total flood area by the county-equivalent column (e.g., 'region')
# Add a county column manually (this is just an example)
# You would need to assign the correct counties based on the polygons
flood_data$county <- c("Garissa", "Kilifi", "Tana River","Garissa", "Kilifi", "Tana River","Garissa", "Kilifi", "Tana River","Garissa", "Kilifi", "Tana River","Garissa", "Kilifi", "Tana River","Garissa", "Kilifi", "Tana River","Garissa", "Kilifi", "Tana River","Garissa", "Kilifi") # Example values
# Now summarize the total area by this new 'county' column
total_area_by_county <- flood_data %>%
group_by(county) %>%
summarise(total_area = sum(area))
# View the result
total_area_by_county
# Summarize the area by county (assuming there is a county column in the data)
total_area_by_county <- flood_data %>%
group_by(county) %>%
summarise(total_area = sum(area))
# View the results
total_area_by_county
colnames(flood_data)
## [1] "Water_Clas" "Sensor_ID" "Sensor_Dat" "Confidence" "Field_Vali"
## [6] "Water_Stat" "Notes" "Area_m2" "Area_ha" "SenorID_ol"
## [11] "StaffID" "EventCode" "Shape_Leng" "Shape_Area" "geometry"
## [16] "area" "county"
# Summarize the total flood area (in hectares) by county
total_flood_by_county <- flood_data %>%
group_by(county) %>%
summarise(total_area_ha = sum(Area_ha, na.rm = TRUE))
# View the results
total_flood_by_county
This report analyzed flood hazard extent data for Garissa, Kilifi, and Tana River counties over the years 2018, 2019, and 2023. The analysis provided insights into the total flood areas for each county, the changes in flood extent over time, and highlighted which county was most affected by flooding in 2023.
Further analysis could focus on the specific causes of the flooding, its impact on local communities, and possible mitigation strategies.