Automatic Identification and Mapping of Global Floodplains in A Web Browser
Introduction
Floods have become more frequent worldwide throughout the years as human influence and climate change have increasingly altered the environment1,2. With increasing awareness against flood hazards, there has been a recent trend of developing floodplain maps across the world. Yet, downloading, pre-processing, and subsequent geospatial analyses to map these floodplain datasets, and therefore identify areas that are within a flood hazard zone, remain laborious and time-consuming. This tutorial will introduce a python-based tool to automatically download and process the necessary data to map floodplain extent in any county within the United States. With simple modifications this tool can be used to map floodplains in any part of the world.
Although this tool uses a specific county in the United States as a test case, it is applicable to any county of interest. The tool utilizes a widely used global floodplain dataset3.
The tool has two unique features:
- It is an end-to-end workflow that performs all data discovery, download, pre-processing, and analysis tasks in a semi-automatic manner.
- Students (or any potential user) can run this tool simply in a web browser without having to write python code or installing any software in local computers.
Tool URL: https://colab.research.google.com/drive/1xQlARZXKPexmDInYV-EMoJ-HZxmFL-eW?usp=sharing
Video Demonstration: https://youtu.be/TgMbkJdALig
Conceptual Outcomes
- Students will understand how to map floodplains for a given location, and therefore identify areas (e.g., communities, neighborhoods) that are susceptible to flood hazards.
- The floodplain maps derived from this tool will provide essential insights into the vulnerability of population and infrastructure to future floods and further improve flood mitigation and insurance strategies.
Practical Outcomes
- By completing this tutorial, students will learn how to develop and run python codes easily using a web-based platform called Google Colaboratory.
- Students will get hands-on training on end-to-end discovery, integration, and analysis of complex geospatial big data.
- Students will learn how to search, download, and map global floodplain datasets by running the Google Colaboratory python code, downloading the output data, and finally performing additional mapping and visualization tasks on a local computer.
Time Required
It would take roughly 60 minutes to complete this tutorial (using the test case: floodplains in Harris County, Texas, United States). The required time may vary with the extent of the target area and the internet connection quality.
Instructions
First, read this short tutorial carefully to set up your Google Colaboratory: Setting Up Google Colaboratory to Run Python Codes (Acrobat (PDF) 243kB Oct3 21)
Let's start by clicking on this link: https://colab.research.google.com/drive/1xQlARZXKPexmDInYV-EMoJ-HZxmFL-eW?usp=sharing. This will open a python code in your computer's web browser.
Watch this instructional video https://youtu.be/TgMbkJdALig to make yourself familiar with all the steps followed in this tutorial. You will see how we extracted the data to generate a floodplain map in our desired location of interest. You can execute every step by merely clicking the play button or pressing "Ctrl+Enter". To run the Harris County test case, no change in the code is necessary. You can, of course, run the tool for any area of interest in the United States.
Relevant notes associated with each step are provided below.
If this is not the first time you have used this tool, then edit the following line of the code by deleting the "#" symbol and press the play button. Pressing the play button will clear any data that you have generated by this tool in your previous attempts. If this is your first time running this tool, you can start directly from Step 1.
Within each step, often times there are several cells to run. Be sure to run every cell within each step to avoid receiving any errors. If a step is skipped and an error occurs, go back to this cell, delete the "#" symbol and press play. Then go to step 1 and start from the beginning.
Step 1: Install python modules
You may see a warning message like the one shown below when you run this step. To resolve this problem, click the "restart runtime" button (the blue rectangle), go back to step 1, and run again.
Step 2: Import modules
In this step, you are going to "call" the python packages/modules that you installed in the previous step. Once you call them, those packages/modules will be ready to perform specific geospatial functions in the subsequent steps.
Step 3: Download the global floodplain extent dataset
The floodplain in the default setting of this tool covers all the major river basins in the world. Depending on the location of your interest, you need to identify and type in a specific region. You can choose from one of the following six options: AF, AS, EU, NA, OC, SA, meaning Africa, Asia, Europe, North America, Oceania, and South Africa, respectively. For our test case (because Harris County, Texas is in North America), we typed in NA (North America) and pressed 'enter'. This will command the code to clip a desired portion from the global floodplain automatically.
Following this step, you may run the next cell which allows you to delete the directory files that you do not need.
Step 4: Select your location of interest
Here you will download the U.S. counties shapefile. Once completed, you will need to type in the U.S. state name, make sure you start with a capital letter. If the state has a two-word name, be sure to exclude the space in between the two words. For example, if the state chosen is North Dakota, type in "NorthDakota". For our test case type in "Texas" and press 'enter'. The map below will load your desired state along with the counties therein. Simply browse over the map to find your target county. Note how the map shows county names as you move your cursor.
Here you will need to type in your desired county name exactly as it appears on the map. Just like the state name, if the county name is a two-word name, exclude the space in between the two words. For our test case we will choose Harris County. Type in the county name "Harris" and press enter.
Step 5. Extract floodplain for a selected area
In this step, you will first reproject the study area boundary to match the floodplain dataset's spatial coordinate system. Then you will extract the floodplain by using the reprojected boundary shapefile. Executing this step will ensure that you have the floodplain data only for your study area. Ignore any warning message that you may see in this step. As long as you are able to generate floodplain.tif (see the left panel in Google Colaboratory), this will indicate that your code is working correctly. Pay extra attention to run all cells in this step.
Step 6: Map your floodplains
Run all cells and in the last cell you will see your floodplain map generated for your location of interest.
Step 7. Save your floodplain map and download to your local computer
You just created a floodplain map for Harris County, Texas. You can download this map, to your local computer by running these next three cells. An indicator that this step has been successfully completed is if you have downloaded "results.zip" to your computer. You can see the floodplain map that you just prepared by simply clicking on the html file within the "results" folder. Clicking on the html file will display the map on a web-browser. You can also use ArcGIS or other desktop-based GIS software to further analyze the floodplain map.
Great Job! Now you know how to run a python code using google colaboratory, and how to map floodplains using this web-based python tool! Restart this tutorial to generate a similar map for any other location of your interest!
References:
- Rajib, A. Zheng, Q., Lane, C., Golden, H., Christensen, J., Isibor, I., Johnson, K., 2023. Human alterations of the global floodplains 1992–2019, Nature Scientific Data. https://www.nature.com/articles/s41597-023-02382-x
- Rajib, A. Zheng, Q., Golden, H., Lane, C., Wu, Q., Christensen, J., Morrison, R., Nardi, F., Annis, A., 2021. The changing face of floodplains in the Mississippi River Basin detected by a 60-year land use change dataset, Nature Scientific Data. https://www.nature.com/articles/s41597-021-01048-w
- Nardi, F., Annis, A., Di Baldassarre, G. et al., 2019. GFPLAIN250m, a global high-resolution dataset of Earth's floodplains. Nature Sci Data 6, 180309. https://doi.org/10.1038/sdata.2018.309.