Detection of Land Use Change in Floodplains Using Web-based Python Programming

Qianjin Zheng, Adnan Rajib, Corando Gallegos, Kurtis Kuypers, and Tamara Guillen, The H2I (Hydrology & Hydroinformatics Innovation) Lab, Department of Environmental Engineering, Texas A & M University, Kingsville

This tutorial was developed through a classroom cybertraining experiment at the Texas A & M University, Kingsville. A team of seven graduate students developed this tutorial during their participation in EVEN6340: Decision Sciences For Environmental Systems⎼ a graduate level course. The course was offered by Dr. Adnan Rajib in Fall 2020.


Author Profile


Human interventions are increasingly altering the world's floodplains. With the advances in remotely sensed earth observations and geoinformatics, we are now able to assess floodplain alterations by estimating the changes in its land use. Yet, downloading, pre-processing, and subsequent geospatial analyses of land use and floodplain datasets remain laborious and time-consuming, not to mention these tasks require specific programming and software solutions. This tutorial will introduce a python-based tool to download and process necessary data, and subsequently detect land use change in the world's floodplains.

Although this tool uses a specific area in the United States (Iowa) as a test case, it is applicable to any area of interest across the major river basins of the world. The tool utilizes a global floodplain dataset1 and three different land use datasets2-5 with varying spatial resolutions and temporal extents.

The tool has two unique features:

  1. It is an end-to-end workflow that performs all data discovery, download, pre-processing, and analysis tasks in a semi-automatic manner, not limited only to the detection of changes across a given set of land use data.
  2. Students (or any potential user) can run this tool simply in a web browser without having to write python code or setting up an environment in local computers.

Tool URL:

Video demonstration:

Conceptual Outcomes

  • Students will understand how the world's floodplains are being affected by human activities over the years.
  • The floodplain land use change maps derived from this tool will provide essential insights on 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 create a floodplain land use change dataset 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 Iowa, United States). The required time may vary with the extent of study area and the internet connection quality.


First, read this short tutorial carefully to set up your Google Colaboratory: Setting Up Google Colaboratory to Run Python Codes.pdf (Acrobat (PDF) 243kB Jan23 21)

Let's start by clicking on this link: This will open a python code in your computer's web browser (will require an active gmail account).

Now, watch this instructional video to make yourself familiar with all the steps followed in the tutorial. You will see how we extracted historical land use for the floodplains in Iowa, United States, and generated a map showing the changes in those floodplains between 1941 and 2000. You can execute every step by merely clicking the play button or pressing "Ctrl+Enter". To run the Iowa test case, no change in the code is necessary. You can, of course, run the tool for any area of interest.

Relevant notes associated with every step in the code are provided below.

Step 1: Set input and output

You DO NOT have to write hundreds of lines of code to run this tool! If you wish to run this tool for your own study area, all you need to do is populate study_area_zip_url and study_area_root_dir with relevant information (see an example below). Note that your study area's boundary shapefile must be kept in a folder, zipped, and uploaded to a shared google drive. The name of the original folder and the zip file must be identical.

Step 2: Install 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 3: 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 4: Download study area boundary shapefile

In this step, you will download the study area boundary shapefile that you previously uploaded in a shared google drive (step 1).

Step 5: Download floodplain boundary 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 select a specific region. You can select 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 Iowa/United States is in North America), we selected NA (North America). This selection will command the code to clip a desired portion from the global floodplain automatically.

Step 6. 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 steps 5 and 6 carefully 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.

Step 7. Download and extract land use dataset for the selected area

This tool is capable of automatically accessing three long-term land use datasets. The spatial extent for two of these datasets is limited to the United States, while the third dataset is available for the entire world. The three datasets are named respectively as the USGS data, NLCD data, and Remotely sensed data (see the corresponding references at the end of this tutorial).

You also need to define the initial and final year of your land use change analysis. For our test case in this tutorial, we selected USGS data and entered 1941 and 2000 as our initial and final years.

Step 8. Generate the Change versus No Change map

In this step, you will detect the difference or "non-uniqueness" between two land use datasets (for 1941 and 2000, respectively) and therefore generate a map.

Step 9. Mask the change map with floodplain boundary

You are going to mask the change map created in step 8 with the floodplain boundary processed in step 6. This will be the final output ⎼a map showing the changes in land use within the floodplain.

Step 10. Download the results to local computer

You just created a floodplain land use change map for Iowa, United States, showing 60-years of floodplain alterations between 1941 and 2000. You can download this map, including the floodplain boundary, to your local computer by running this step.

Using ArcGIS or other desktop-based GIS software, you can further analyze the floodplain land use change map that you just created. If you are not familiar with ArcGIS, please read this short tutorial: Using ArcGIS to Visualize Floodplain Land Use Change Map.pdf (Acrobat (PDF) 786kB Jan24 21)

Well done! Now you know how to run a python code and detect land use change in floodplains!

Look at the map you just created. Can you think of possible reasons for these alterations (red colors)? Also, think about how you can generate a similar map for any other location of your interest (revisit step 1).


  1. 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.
  2. Sohl, T.L., Reker, R.R., Bouchard, M.A. et. al., 2018a. Modeled historical land use and land cover for the conterminous United States: 1938-1992. U.S. Geological Survey data release,
  3. Sohl, T.L., Sayler, K.L., Bouchard, M.A. et al, 2018b. Conterminous United States Land Cover Projections - 1992 to 2100. U.S. Geological Survey data release,
  4. Homer, C., Dewitz, J., Jin, S. et al., 2020. Conterminous United States land cover change patterns 2001–2016 from the 2016 National Land Cover Database. ISPRS Journal of Photogrammetry and Remote Sensing162, 184–199,
  5. Climate Change Initiative (CCI) of the European Space Agency, 2018. CCI-LC products.

Last updated: February 9, 2021