Inland flooding is known to pose threats to people, infrastructure, businesses etc. especially in coastal towns. Inundation of the roads during floods disrupts the street networks making it difficult for people to reach places of interest. can limit local residents’ outdoor trips not only by the storm events, but also by disturbing the street network because the flash flood can cause standing water on the street, which, if cannot be drained properly, it won’t be safe for people to get on the “watered”, slippery roads.
Through this project we attempt to gauge how street networks and people’s outdoor trips are affected during floods.
We look at the robustness of the street network linking each census tract to local restaurants assuming that restaurants are common destinations visited by people on a daily basis for people to socialise and enjoy their lives together. And therefore, any disturbance in the accessibility of restaurants will have a noticeable impact on people’s lives.
In this project we focus on the city of Charleston, SC. Charleston is the most populous city in South Carolina, the county seat of Charleston County and the principal city in the Charleston metropolitan area. This city was selected for the study because coastal flooding, inland flooding and storm flooding are common occurrences in Charleston delivering devastating impacts to the city. We studied one such tidal flood event that occurred on 20th - 21st March 2023 to understand how the street network and people’s trips of the city was disrupted by this event.
The methodology followed for this study is divided into 4 steps
summarized in the graphic below
The flood map is generated using the remote sensing Sentinel-1 from Google earth engine
(the link below may not be working after publishing this document to Rpub, I put it the comments on my project submission page as well):
https://code.earthengine.google.com/d5d42b688e52609c898429ba0639f1a2
It is a flood extent mapping by calculating the difference of the surface reflection before and after the flood event.
The code template was referenced from the tutorial:
“Step-by-Step: Recommended Practice: Flood Mapping and Damage Assessment Using Sentinel-1 SAR Data in Google Earth Engine.” United Nations. https://un-spider.org/advisory-support/recommended-practices/recommended-practice-google-earth-engine-flood-mapping/step-by-step#Step%2013:%20Affected%20urban%20areas
Then by taking this flood extent mapping as a vector layer. We used it to clipped the “un-disrupted” street network.
We downloaded and processed the street networks from open street map. Then we got our “shortest-path-to-restaurant network” (the network linking each census tract in Charleston city to all the local restaurants) by getting the shortest paths from each census tract’s centroid to all the restaurants.
After that, we cut the network into disconnected pieces, which demonstrated that the street network was substantially disrupted after the tidal floods.
However, since it is hard to calculate “after-flooding” network with disconnected network pieces, alternatively, we weighted the “flooded streets” (the street lines overlapping with the polygons of the flooded areas) to 0.5 by assuming that people could still get onto these streets if they drove with extra carefulness but they are not the preferred roads. Then we calculated all the shortest paths again using the weighted network (weight = 0.5 if flooded, weight = 1 if not flooded).
By overlaying the shortest paths before the tidal event and the shortest paths after the event, some crucial segments were identified: the streets appeared in the shortest paths before the tidal event but did not in the paths after the event.
This finding can suggest which part of the roads / part of the city areas need extra caring. Maybe a better drainage system is needed, maybe a better stormwater management practice is needed such as a more pervious surfaces, more green spaces/green roofs, etc.
Also, a layer downloaded from census tract was stacked on the map as well (the median household income) so that we can have some ideas about which communities (rich communities or poor communities) have most of the “disrupted roads” and are impacted by the tidal events very much.
First of all, below are all the packages we are going to use in our analysis:
library(tidyverse)
library(tmap)
library(ggplot2)
library(units)
library(sf)
library(leaflet)
library(tidycensus)
library(leafsync)
library(dbscan)
library(sfnetworks)
library(tigris)
library(tidygraph)
library(plotly)
library(osmdata)
library(here)
library(tidytransit)
library(units)
library(leaflet)
library(tidycensus)
library(leafsync)
epsg <- 4326
Download census tract data for API request and select our variables of interest. We also calculated the population density using the total population in each tract and the area of the tract. Because we will use population density later in our analysis.
census_api_key(Sys.getenv("census_api"))
## To install your API key for use in future sessions, run this function with `install = TRUE`.
### Tract polygons for the Yelp query
tract <- suppressMessages(
get_acs(geography = "tract", # or "block group", "county", "state" etc.
state = "SC",
county = c("charleston"),
variables = c(hhincome = 'B19019_001',
race.tot = "B02001_001",
race.white = "B02001_002",
race.black = 'B02001_003'
),
year = 2021,
survey = "acs5", # American Community Survey 5-year estimate
geometry = TRUE, # returns sf objects
output = "wide") # wide vs. long
)
Get the boundary for Charleston city
charleston <- places('SC') %>%
filter(NAME == 'Charleston')
Intersect the county level census tracts with the city boundary because the city is the area of scope that we are interested in. And we named our area of study as “charcity_tract” after intersection.
View of the area in our study:
## tmap mode set to interactive viewing
Then, we created centroids in each census tract to:
use them as the “origins” of the trips to all the restaurants
use them to request yelp data of restaurants in Charleston city
After creating the centroid of each census tract and get their coordinates information, we used the function we learned from Module 1 to request yelp data:
We got our tools ready, and it is time to request data from yelp api:
# Prepare a collector
yelp_all_list <- vector("list", nrow(ready_4_yelp))
# Looping through all Census Tracts
for (row in 1:nrow(ready_4_yelp)){
yelp_all_list[[row]] <- suppressMessages(get_yelp(ready_4_yelp[row,], "restaurants"))
if (row %% 10 == 0){
print(paste0("Current row: ", row))
}
}
# Collapsing the list into a data.frame
eatinchar_yelp <- yelp_all_list %>% bind_rows() %>% as_tibble()
# print
eatinchar_yelp %>% print(width=1000)
We saved our requested data into local folder so we will not need to sweat ourselves to request the data every time we update our analysis:
# Save before-tidied eatinchar_yelp to a file
saveRDS(eatinchar_yelp, "eatinchar_yelp_raw.rds")
Read in our data every time we need it, which is great!
eatinchar_yelp_raw <- read_rds("eatinchar_yelp_raw.rds")
Then we cleaned the yelp data we requested so it can be ready for our analysis.
We also checked the missing data, and no missing data in our analysis of interest was found (coordinates, reviews and rating).
So now, the yelp data is ready to view.
Since there are several hundreds of restaurants, we will only show the “popular and good ones” on the map
(We set threshold as review counts > 500 and rating > 3)
## Legend for symbol sizes not available in view mode.
There are some data points outside of our study area for some reason, so we need to get the data points further cleaned by intersecting the Charleston city boundary and the yelp data points:
st_crs(charleston) <- 4326
## Warning: st_crs<- : replacing crs does not reproject data; use st_transform for
## that
eatwithinchar_yelp_sf <- eatinchar_yelp_sf[charleston, ,op = st_intersects]
After further cleaning, we viewed our result again:
## Legend for symbol sizes not available in view mode.
Now only the data points lying within / at the boundary are retained. The yelp data points are ready for use as destinations of the trips.
We downloaded the street information from OSM, then created a street network from the downloaded polylines.
Before calculating the shortest paths between the controids of census tracts and the local restaurants, let’s view the un-disrupted street network:
We also calculated the betweenness centrality using this intact network, so that we can know the important street segments that are falling on the “shortest” paths to all the possible destinations.
Let’s take a look at the road importance hierarchy created from the betweenness centrality:
The map is showing the hierarchy of the importance of the street segments. The more red the segment is, the more frequent it lies in part of the shortest paths to “somewhere” in the city.
And we can use this hierarchy to set priority when assessing which flooded segments are more critical.
Then, we tried the simulation from just one census tract to one restaurant as a pilot test.
We picked the centroid of the census tract. And when we expand our route analysis to the whole city, we will loop through the centroids of all the cenesus tracts as our origins.
Below shows the path from our first trial:
The trial shortest path was successfully calculated.
Now, it is time to look at how the street network will be impacted by the tidal event.
So first of all, we read in the flood extent mapping as polygons, which is a shape file created from Google Earth Engine:
flooded_char <- read_sf(here("floodedcharv2","flooded_char-v2.shp"))
View the flood extent mapping (a much larger area was exported from Google earth engine to ensure that our study area will be covered)
We first intersected the un-disrupted street network (all the streets, not the shortest paths yet) and the flood map to get the flooded road lines.
Then, we clipped out those flooded roads to get the “after flood” road network
(We have to do this 2-step approach instead of doing anti-join because the latter method took too long to process and eventually made the program crash.)
And let’s view the street network after flood
Note that the roads are cut into disconnected pieces if we assume the flooded roads would not be accessible at all.
Recall that we did a shortest path trial using the un-disrupted street network. We were trying to find a path from same origin and same destination using this greatly segmented network. However, the destination is not reachable any more because of the disconnections within the network.
We figured something interesting to look at instead is to see how many restaurants, out of 646 in total are still reachable.
This analysis can give an idea about how the businesses are impacted by the floods. It is worth knowing because if those businesses owners could not have many customers, their income will be substantially impacted, at least during the period of the tidal events.
We did this analysis only using 1 origin, which is the same origin we used in our previous trial. And the destinations will all the 646 restaurants, not only the “popular, highly rated” ones.
# Find the paths from origin to all reachable restaurants
# using st_network_paths() function.
paths_all_after <- st_network_paths(osm_after, from = origin, to = eatwithinchar_yelp_sf, type = "shortest")
## Warning in shortest_paths(x, from, to, weights = weights, output = "both", : At
## core/paths/dijkstra.c:446 : Couldn't reach some vertices.
And it turns out:
Only 45 out of 646 restaurants are reachable after the flooding event.
View the paths on the map:
Although the highlighted routes won’t make much sense without reachable restaurants tagged along with them, you can still get a general idea that, the area people can go by driving is very limited after flooding.
Since it is hard to compare the road networks before and after the flood if clipping the original intact network into disconnected segments. We wanted to find the after-flooding paths by putting different weights on flooded / not flooded roads by using the alternative assumption that people can still drive on the flooded roads, if and only if there is no other streets to drive.
First and again, we did a trial comparison using one origin and one destination.
Let’s view the before and after flood route on one map:
As we can see from the map, after the tidal event, people had to take a detour to go to that restaurant.
Now we wanted to add more restaurants as our destinations. We would still like to choose the popular and good ones instead of putting all the restaurants into destinations because:
We assume that those restaurants are people’s go to places when eating outside, so the routes there would be taken by many people, which, if being disrupted by flood events, will have apparent impacts on peoples outdoor entertaining activities and outdoor trips.
By limiting the number of paths to be calculated, we can have a cleaner map when showing them together on the map.
We set the threshold as:
Rating >= 4.5 and,
The 4th quantile of the distribution of “review count”
pop_eats <- eatwithinchar_yelp_sf %>%
filter(rating>=4.5) %>%
filter(review_count>quantile(review_count)[4])
While we were looping through all the “home origins” (the centroid of each census tract), we figured that there were still a few restaurants not reachable with the intact street network. We suspected that they could be the ones located on the edge of the city boundaries, to which some of the street segments were not included in the bounding box at the very beginning.
But we will ignore this warning message for now, since it won’t impact our analysis overall, because we want to find the streets that are more prone to the flood events rather than ensuring every popular and good restaurants are reachable.
After getting the “before flood event” and “after flood event” routes, we want to visualize our analysis by overlaying 3 components together:
The shortest paths to “popular and good restaurants” before the tidal events
The shortest paths to “popular and good restaurants” after the tidal events
The median household income of each census tract
(The legend is showing the percentile of the median household income distribution, from low to high. You can click on the polygon to see the actual number)
By overlaying the before-flood shortest paths and the after-flood shortest paths together. It can be seen that there are some road segments picked in the intact street network (the unweighted street network) but not picked in the disrupted street network. For these segments, it can be sure that they are prone to the tidal flood. And some further investigations about why these segments are more likely to be disrupted can start from here (For example, it may because they are located at lower elevations, or because the area are mostly impervious area so it is hard for water to be drained into the earth, or because some parts of the drainage system wasn’t performing well during that tidal event, etc.)
It seems like some of these street segments are lying in the lower income community. However, it is hard to tell if the dominant part of these segments are situated in rich communities or the others.
Since the neighborhood income didn’t give us a pattern to narrow down the weak street network to prioritize, we figured it could be a good idea to see if the population density could give us a focused area to prioritize.
(The legend is showing the percentile of the population density distribution, from low to high. You can click on the polygon to see the actual number)
The center of the Charleston city have a very high population density, in which each tract has over 1000 people each kilometer. So the improvement of the street network in this area should be prioritized not only because a very dense population will be impacted, but also because the network is highly probably located in a busy area with many businesses connected, as we can induced from the population density.
To further narrow down our priorities on improvements of street segments, we can over lay the analysis with the betweenness centrality result, which is telling us which roads are most frequently lying on the “shortest paths” to all the possible destinations, not only restaurants.
So zoom the map into the city center (our prioritized area), we you see that the red segments, with the “fat” nodes are the main road segments we want to start our further investigation because:
These segments are impacted by the flood and were left out in the “after-flooding” shortest paths selection.
They are the segments that are critically important because they ought to be part of the shortest routes to all possible destination if the street network in intact, in other words, if the street network is not flooded.
Last but not least, we noticed that there might be some more important road segment that we overlooked. After we reduce the importance to the flooded road segments to half of those not flooded road segments (weights = 0.5 for flooded road segments then weights = 1 for not flooded road segments), the algorithm in the “shortest path” centrality would still pick some of them as part of the trajectory when there is no “not flooded road segments” to pick. Therefore, we thought it would be important to find out which “flooded road” segment were still picked as part of the “shortest paths”.
Note that in the map above I colored the edges of flooded road segments in orange and “dramatize” the nodes of the flooded road segments with salient, yellow color and larger radius, compared to the small blue nodes, which are the nodes of the after-flooding shortest paths.
It is very astonishing to find out that many flooded road segments are still picked as part of the paths to all those popular, good restaurant because otherwise those restaurants are not reachable anymore.
Then zoom into our area of interest, identified by the population density, which is the center of the city with the busiest road network. We can notice that there are some “triple overlapping” segments, and those segments are:
segments that are flooded;
segments important paths to all the possible destinations, not only to those restaurants;
segments that the algorithm has to pick, even though they are not recommended, when finding the routes to all those popular, good restaurants because otherwise, it has no route to go.
Therefore, these road segments are the most critical routes and needs to be taken care of the most.
Restaurants: We found that the floods had an impact on accessibility to restaurants. Though we only did the test using one origin (one census tract centroid), we found that from that origin, only 45 out of 646 were reachable. This is a huge difference.
Street Network: We found which streets are affected after a tidal flooding event, and how the trips of people would change (based on shortest path) during floods. The bit daunting point is that, not only will people have to take detours to reach places of their interest in the event of a flood if they want to avoid the flooded streets as much as possible, but also, there are still many flooded, slippery streets they have to get on if they still want to go to those “popular, highly rated” restaurants. And we pointed out that those streets are very critical, of which robustness need to be investigated and improved first.
In our analysis, we selected the priority areas for intervention that would ensure a more smooth-functioning network based on the number of people being affected and the importance of nodes in the overall network. The areas we narrowed down on were two census tracts - Avondale and Downtown and recommend that the important nodes and segments in these areas must be priorities for flood prevention interventions so that it can have a wider impact.
Preventing roads from flooding would involve a combination of engineering, infrastructure, and environmental interventions. Some interventions that the city could take for making these affected streets flood-proof are:
Designing proper stormwater drainage systems to collect and divert rainwater away from roads.
Elevated road design can help in reducing the risk of inundation during heavy rainfall or storm surges.
Other environmental interventions could involve building permeable pavements, retention ponds, vegetative swales, flood channels etc.
These critical areas identified can also be used for emergency response planning including planning of evacuation routes to ensure a quick response in case of flooding.