Supervised Classification for Flood Monitoring Using the Semi-Automatic Classification Plugin


 Updated tutorial at 
https://fromgistors.blogspot.com/2017/01/flood-monitoring.html





Flooding is the 'overflowing of the normal confines of a stream or other body of water, or the accumulation of water over areas that are not normally submerged' (IPCC, 2012: Managing the Risks of Extreme Events and Disasters to Advance Climate Change Adaptation. A Special Report of Working Groups I and II of the Intergovernmental Panel on Climate Change).

Unfortunately, a severe flooding has affected Pakistan recently, inundating more than one thousand villages as reported in this article by NASA. Flood monitoring is fundamental in these emergency situations, and for planning actions of prevention and adaptation to flooding.

This tutorial illustrates how to monitor floods performing the supervised classification of Landsat images (however the same methodology could be applied to other sensors such as MODIS images)In particular, we are going to classify two images acquired in 2013 in Cambodia; in October, the heavy seasonal rains were followed by the Typhoon Nari causing the flood along the Mekong and TonlĂ© Sap rivers, affecting more than a half-million people (for more information about this and other flooding events, read the article by NASA here). You can see the study area before and after the flood in this image by NASA.

Study area, Cambodia
(image available from the U.S. Geological Survey)

Before starting this tutorial, if using the Semi-Automatic Classification Plugin for the first time, please follow the basic tutorial here.
We are going to classify a Landsat 8 image acquired on 17/05/2013 (before the flood) and a Landsat 8 image acquired on 24/10/2013 (after the flood), in order to assess the land cover change using a semi-automatic approach.
Download the Landsat image before the flood from here and the Landsat image after the flood from here (images available from the U.S. Geological Survey). Landsat 8 image includes the bands described in this table (each band is a single 16 bit raster).

Band IDLandsat 8 Band NumberSpectral Range
1Band 2Blue
2Band 3Green
3Band 4Red
4Band 5Near-Infrared
5Band 6Short Wavelength Infrared 1
6Band 7Short Wavelength Infrared 2


The following are the main classification steps:
  1. Conversion of raster bands from DN to Reflectance for the image before flood;
  2. Creation of the ROIs and spectral signatures for the image before flood;
  3. Classification of the image before flood;
  4. Conversion of raster bands from DN to Reflectance for the image after flood;
  5. Classification of the image after flood;
  6. Calculation of the land cover change.

The main approach is to classify Water defining a classification threshold in order to identify only those pixels that are very similar to collected spectral signatures.
Following, the video of this tutorial and the description of the phases.


1. Conversion of raster bands from DN to Reflectance for the image before flood

The conversion of raster bands to surface reflectance, performing the image-based atmospheric correction using the DOS1 method, aims to improve the classification results.

Steps:
  • Open QGIS and start the Semi-Automatic Classification Plugin;
  • In the main interface select the tab Pre processing > Landsat;
  • Select the directory that contains the Landsat 5 bands, and select the output directory where converted bands are saved;
  • Check the option Apply DOS1 atmospheric correction, and click Perform conversion to convert Landsat bands to reflectance (leaving checked Create Virtual Raster);
SCP tab Landsat
  • At the end of the process, converted bands are loaded in QGIS; also, a virtual raster named landsat.vrt is loaded (containing all the Landsat bands converted to reflectance);
  • Select the Landsat virtual raster, left click and open its properties; in Style select band 4 (i.e. Near-Infrared) for the red band, band 3 (i.e. Red) for the green band, and band 2 (i.e. Green) for the blue band, and click OK (if the image appear black, click the button Load cumulative cut stretch in the Raster toolbar of QGIS).
Properties of the Landsat virtual raster


The result of the color composite is shown in the following image.

Landsat 8 color composite RGB=543

2. Creation of the ROIs and spectral signatures for the image before flood

We need to collect the ROIs that define the land cover class of water. We do not need to define other land cover classes because we are going to use a threshold during the classification process.
  • Select the Landsat virtual raster as input image; we must however define the band center wavelength in the Band set tab. As you can see, it is not possible to move the bands (they are already ordered), therefore we just need to select the Landsat 8 item under Quick wavelength settings;
SCP tab Band set
  • Define the training shapefile (for the ROI collection), and the signature list file (which stores the spectral signatures calculated from ROIs or imported from other sources) as described here (step 2);
Definition of the classification input
  • In the dock ROI creation click the button + beside Create a ROI and then click a water area (blue/cyan pixels);
  • Under ROI Signature definition type a brief description of the ROI inside the field Class Information and Macroclass Information, and assign a Macroclass ID and Class ID;
  • In order to save the ROI to the training shapefile click the button Save ROI to shapefile; if the checkbox Add sig. list is checked, then the spectral signature is added to the Signature list table;
  • Define the class color with a double click on the Color column in the Signature list.
Collection of a ROI and spectral signature

It is important to collect ROIs of dark water and light water, as in the following images.

3. Classification of the image before flood

In order to classify only water, we are going to process the image using the Spectral Angle Mapping algorithm with the definition of a threshold. Depending on the threshold value, pixels will be classified as water if the angle between the spectral signatures thereof and the spectral signatures collected in the previous step is below the threshold value.
We need to find the maximum threshold value that allows for the identification of all the water in the image. However, if the threshold value is too high then non-water pixels are going to be incorrectly classified as water.

Steps:
  • In the dock Classification, under Classification preview set Size = 500; check Use Macroclass ID, and select the Spectral Angle Mapping algorithm; under Threshold type 10 and click the button + and then click on the image; after a few seconds, the classification preview will be displayed;
Classification preview
  • In order to perform the final classification, under Threshold type 20 and click the button Perform classification and select where to save the output (e.g. classification_before.tif).
Classification of water

You can download the classification along with the ROIs and Spectral signature file from here.

4. Conversion of raster bands from DN to Reflectance for the image after flood

As we did in the point 1 of this tutorial, we convert the Landsat band to surface reflectance. It is recommended to open a new QGIS project for this.
The result is showed in the following image.

Study area after the flood 

5. Classification of the image after flood

Now we are going to classify the image after the flood. However, we are not collecting new ROIs on this image; instead we use the spectral signatures created in the step 2 of this tutorial.

Steps:
  • Select the Landsat virtual raster as input image; in the Band set tab, select the Landsat 8 item under Quick wavelength settings;
  • In the dock Classification, click Open and select the signature list file that we have previously saved  (i.e. SIG.xml);
  • In order to perform the classification, select the Spectral Angle Mapping algorithm; check Use Macroclass IDunder Threshold type 20 and click the button Perform classification then select where to save the output (e.g. classification_after.tif).
Classification of water, after the flood

You can download this classification from here.

6. Calculation of the land cover change

In order to assess the flooded area we are going to calculate the land cover change between the two classifications.

Steps:
  • Open the classification_before.tif in QGIS;
  • Select the tab Post processing > Land cover change of the SCP Main interface;
  • Select the classification_before.tif as reference classification, and select classification_after.tif as new classificationclick the button Calculate land cover change; select where to save the land cover change raster (in addition, a file .csv will be saved in the same directory, containing the statistics of the classes of change);
Land cover change report
  • After a few seconds the land cover change raster will be displayed in QGIS; the statistics of the classes of change are displayed in the tab Land cover change.
Land cover change raster

The land cover change raster can be downloaded from here.

As you can see in the land cover change raster, flooded area is represented in red, while the blue area was not flooded; the area usually covered by water is represented in green. This raster could be converted to shapefile or for instance used in spatial analyses for estimating the population affected by this flood.

This tutorial showed a very rapid and affordable method of flood monitoring that could be useful for local administrations.
Of course, it is fundamental the acquisition of remote sensing images during the flooding, and the cloud cover could prevent the acquisition of useful images; it is worth mentioning other methodologies such as SAR (i.e. Synthetic Aperture Radar) that are not affected by cloud cover, and allow for flood monitoring. Watch the following footage about the Sentinel 1 satellite by ESA).
 

Please, remember that a Facebook group and a Google+ Community are available for sharing information and asking for help about the Semi-Automatic Classification Plugin.
Newer posts Older posts