Introduction
Two years have passed since Huricane Harvey hit the Texas coastline and Houston area. Harvey stalled for days, pouring rain, overflowing rivers and reserviors, flooding thosands of homes. The hurricane caused more than $125 billion in damage, tying with Huricane Katrina as the costliest storm in U.S. history. In Harris County alone Hurricane Harvey damaged 204,000 homes and apartment buildings. Many Texans still recall how they, their families, or friends lost their homes, their cars, or businesses to the storm. Harvey marked a before and after in the History of the state and the personal experiences of its residents. Some people where luckier than others, living in homes that were built just high enough for the water to stay in the streets. My parents’ home in the City of Katy, west of Houston was hit with minor roof leaks. After the rain subsided, I drove around neighborhoods close to their house and saw streets filled with carpets, furniture, gutted walls, torn fences, and stalled cars. The same story played out in neighborhoods throughout the city.
I wanted to visualize how Hurricane Harvey affected southern the Texas Coast and the Houston area. For this blog, I used FEMA data of renter and homeowner individual assistance applications, as well as United States Geological Survey (USGS) recorded high-water mark data to create an interactive map. I displayed the FEMA data alongside the USGS data to show how areas with recorded high-water marks during the hurricane water relate to the number of FEMA registrations in each zip code affected by Harvey.

Data Manipulation
The FEMA Excel spreadsheet was separated by tables with owner and renter registrations.I added the libraries used to clean the data and create the map, loaded the data, cleaned column names, and created a “total amounts” column for the renters table by adding moderate, major, and substantial damage columns.
# library for loading data
library(readr)
# libraries for Cleaning Data
library(tidyverse)
library(janitor)
# libraries for map
library(tidycensus)
library(widgetframe)
library(htmltools)
library(leaflet)
library(sf)
head(FEMA_Claims_Owners, 5)
## # A tibble: 5 x 23
## Disaster State County City `Zip Code` `Valid Registra… `Average FEMA I…
## <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl>
## 1 4344 CA Butte… BANG… 95914 54 48015.
## 2 4344 CA Butte… BERR… 95916 2 0
## 3 4344 CA Butte… BIGGS 95917 10 0
## 4 4344 CA Butte… CHICO 95926 66 0
## 5 4344 CA Butte… CHICO 95927 1 0
## # … with 16 more variables: `Total Inspected` <dbl>, `Total Damage` <dbl>,
## # `No FEMA Inspected Damage` <dbl>, `FEMA Inspected Damage between $1
## # and $10,000` <dbl>, `FEMA Inspected Damage between $10,001 and
## # $20,000` <dbl>, `FEMA Inspected Damage between $20,001 and
## # $30,000` <dbl>, `FEMA Inspected Damage > $30,000` <dbl>, `Approved for
## # FEMA Assistance` <dbl>, `Total Approved IHP Amount` <chr>,
## # `Repair/Replace Amount` <chr>, `Rental Amount` <chr>, `Other Needs
## # Amount` <chr>, `Approved between $1 and $10,000` <dbl>, `Approved
## # between $10,001 and $25,000` <dbl>, `Approved between $25,001 and
## # Max` <dbl>, `Total Max Grants` <dbl>
head(FEMA_Claims_Renters, 5)
## # A tibble: 5 x 20
## Disaster State County City `Zip Code` `Valid Registra… `Total Inspecte…
## <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl>
## 1 4332 TX Arans… ARAN… 78336 255 232
## 2 4332 TX Arans… BISH… 78343 1 0
## 3 4332 TX Arans… CEDA… 78613 1 0
## 4 4332 TX Arans… CITY… 78336 1 1
## 5 4332 TX Arans… COLU… 78934 1 1
## # … with 13 more variables: `Inspected with No Damage` <dbl>, `Total with
## # Moderate Damage` <dbl>, `Total with Major Damage` <dbl>, `Total with
## # Substantial Damage` <dbl>, `Approved for FEMA Assistance` <dbl>,
## # `Total Approved IHP Amount` <chr>, `Repair/Replace Amount` <chr>,
## # `Rental Amount` <chr>, `Other Needs Amount` <chr>, `Approved between
## # $1 and $10,000` <dbl>, `Approved between $10,001 and $25,000` <dbl>,
## # `Approved between $25,001 and Max` <dbl>, `Total Max Grants` <dbl>
#clean up headers
FEMA_Claims_Owners <- clean_names(FEMA_Claims_Owners, "lower_camel")
FEMA_Claims_Renters <- clean_names(FEMA_Claims_Renters, "lower_camel")
#remove "(County) from County column
FEMA_Claims_Owners$county <- str_sub(FEMA_Claims_Owners$county,1,-10)
FEMA_Claims_Renters$county <- str_sub(FEMA_Claims_Renters$county, 1,-10)
# create totalDamage column for renters
FEMA_Claims_Renters <- FEMA_Claims_Renters %>% mutate(totalDamage = totalWithModerateDamage +
totalWithMajorDamage + totalWithSubstantialDamage)
# select owner and renter columns
FEMA_Selected_Owners <- FEMA_Claims_Owners %>% select(disaster, state, county,
city, zipCode, validRegistrations, totalInspected, totalDamage, approvedForFemaAssistance)
FEMA_Selected_Renters <- FEMA_Claims_Renters %>% select(disaster, state, county,
city, zipCode, validRegistrations, totalInspected, totalDamage, approvedForFemaAssistance)
I then selected the columns “disaster”, “state”, “county”, “city”, “zipCode”, “validRegistrations”, “totalInspected”“,”totalDamage“”, and “approvedForFemaAssistance” and combined the two tables using the bind_rows
function. After binding the tables I filtered the table by disaster number 4332, which represents Hurricane Harvey.
# binding tables together
Selected_OwnersandRenters <- bind_rows(FEMA_Selected_Owners, FEMA_Selected_Renters)
Selected_OwnersandRenters <- Selected_OwnersandRenters %>% filter(disaster ==
4332)
Creating the Map
The tidycensus
R package allows users to interface with the US Census data APIs and return tidyverse-ready dataframes. I needed to request an API key and use the census_api_key
function to access the data. I set the “geometry”" argument as TRUE to get simple feature geometry of U.S. Zip Codes. I then grouped the data by Zip Code and city, summarised renter and owner registrations, approvals, and added a column to show approval percent.
# join FEMA data and group by zip code.
Selected_OwnersandRenters$zipCode <- as.character(Selected_OwnersandRenters$zipCode)
# Group Zip Codes
FEMA_zipcodes_grouped <- Selected_OwnersandRenters %>% group_by(zipCode, city) %>%
summarise(sumvalidregistrations = sum(validRegistrations), sumapproved = sum(approvedForFemaAssistance)) %>%
mutate(Percentageapproved = round(sumapproved/sumvalidregistrations, 2))
FEMA_zipcodes_grouped <- inner_join(FEMA_zipcodes_grouped, zip_codes_us, by = c(zipCode = "GEOID"))
#drop NA values
FEMA_zipcodes_grouped <- FEMA_zipcodes_grouped %>%
drop_na()
#filter by removing zip codes with low number of registrations
FEMA_zipcodes_grouped <- FEMA_zipcodes_grouped %>% filter(sumvalidregistrations > 25)
FEMA_zipcodes_grouped$geometry <- st_transform(FEMA_zipcodes_grouped$geometry, 4326)
Before adding the code for the map I created label columns to be able to display the data in the map.
# create label column
FEMA_zipcodes_grouped$label <- paste("<p> <strong>Zip Code:", FEMA_zipcodes_grouped$zipCode,
"</P>", "<p> <strong>City:</strong>", FEMA_zipcodes_grouped$city, "</P>",
"<p> <strong>Total Registrations:</strong>", FEMA_zipcodes_grouped$sumvalidregistrations,
"</P>", "<p> <strong>Total Approved:</strong>", FEMA_zipcodes_grouped$sumapproved,
"</P>", "<p> <strong>Percent Approved:</strong>", FEMA_zipcodes_grouped$Percentageapproved *
100, " % </P>")
The Leaflet Package
The leaflet
package makes it easy to create interactive maps by integrating R with the Leaflet open-source JavaScript library. Before adding the functions for the map I made a couple of color palette objects, one for symbolizing the number of FEMA valid registrations, and another for symbolizing the high water marks in terms of elevation feet.
The first step to create the map is to call the leaflet()
function, which creates a map widget. The next step is to add features, such as addProviderTiles()
to select a basemap, addCircles()
to create circles for the high water marks, and addPolygons()
for the Zip code geometries. The popup
argument allows users to select a Zip Code to see the label information. I applied the addLegend()
function to add a legend symbolizing the FEMA number of valid registrations, and addLayersControl()
to be able to show and hide layers.
# create color scheme for registrations and high water mark elevation
pal <- colorNumeric("YlOrRd", domain = FEMA_zipcodes_grouped$sumvalidregistrations,
n = 4)
pal2 <- colorNumeric(c("skyblue", "steelblue2", "royalblue1", "royalblue2"),
domain = High_Water_Marks$elev_ft, n = 4)
# create Map
map_Fema <- leaflet() %>% addProviderTiles(providers$Esri.WorldTopoMap) %>%
setView(lng = -95.3103, lat = 29.7752, zoom = 10) %>% addCircles(lng = High_Water_Marks$longitude,
lat = High_Water_Marks$latitude, group = "High Water Marks", fill = TRUE,
stroke = TRUE, color = pal2(High_Water_Marks$elev_ft), weight = 3, radius = 5,
opacity = 0.6, fillOpacity = 0.6) %>% addPolygons(data = FEMA_zipcodes_grouped$geometry,
weight = 0.5, smooth = 1.5, opacity = 0.5, fillColor = pal(FEMA_zipcodes_grouped$sumvalidregistrations),
fillOpacity = 0.5, group = "FEMA Valid Registrations", popup = lapply(FEMA_zipcodes_grouped$label,
HTML)) %>% addLayersControl(overlayGroups = c("High Water Marks", "FEMA Valid Registrations"),
options = layersControlOptions(collapsed = FALSE)) %>% hideGroup("High Water Marks") %>%
addLegend("bottomright", pal = pal, values = FEMA_zipcodes_grouped$sumvalidregistrations,
title = "FEMA Valid Registrations", opacity = 0.7)
The Map
Although the data does not show the exact number of buildings damaged, FEMA registrations can be used as a proxy to find the areas most affected by Hurricane Harvey. For example, the area around Zip Code 77084 in the city of Houston showed the largest number (12766) of valid registrations for FEMA grants. This Zip Code is located inside one of the reservoirs where storm water rose to historic levels, flooding thousands of homes. High water marks with the highest elevation in feet, represented by the darker blue dots, seem to be located in more rural and sparcely polulated areas between San Antonio and Austin.
frameWidget(map_Fema)
Sources:
United States. Federal Emergency Management Agency. Housing Assistance Data. Washington, DC: FEMA, 2019.https://www.fema.gov/media-library/assets/documents/34758. Data retreived August 12, 2019.
FEMA and the Federal Government cannot vouch for the data or analyses derived from these data after the data have been retrieved from the Agency’s website(s) and/or Data.gov."
United States. United States Geological Survey. USGS Flood Event Viewer. Reston, VA, 2019. https://stn.wim.usgs.gov/FEV/#HarveyAug2017