Satellite Data Analysis and Machine Learning Classification With QGIS - Part 1
Satellite Data Analysis and Machine Learning Classification With QGIS - Part 1
[email protected]; [email protected]
2
QGIS introduction
3
QGIS main graphical user interface
4
Display/hide panels and toolbars
5
QGIS plugins
6
Install QGIS plugins
7
QGIS plugins – Semi-Automatic Classification Plugin (SCP)
Semi-Automatic Classification
Plugin (SCP) is used for
download preprocessing,
classification (supervised and
unsupervised) and
postprocessing of open
satellite imagery (ASTER,
Landsat, MODIS, Sentinel-2
and Sentinel-3)
8
QGIS plugins – QuickMapServices (QMS)
QuickMapServices (QMS)
plugin contains many base
maps created from satellite
imagery:
✓ Bing Satellite /Aerial (Microsoft, up
to 30cm resolution)
✓ Google Satellite (Google, up to 15
cm resolution)
✓ Landsat (USGS, 30m resolution)
✓ Yandex Satellite (Yandex up to
50cm)
✓ …..
In this workshop a basemap
from QMS will be used to
collect training data in the next
session
9
QGIS plugins – dzetsaka: Classification tool
10
About satellite imagery
11
Multispectral satellite imagery
12
Multispectral satellite imagery – Sentinel-2
Central Wavelength
Sentinel-2 Bands [micrometers] Resolution [meters]
Band 1 - Coastal
aerosol 0.443 60
Band 2 - Blue 0.49 10
Band 3 - Green 0.56 10
✓ The SENTINEL-2 Multispectral Instrument Band 4 - Red 0.665 10
(MSI) samples 13 spectral bands: four bands at Band 5 - Vegetation
Red Edge 0.705 20
10 meters, six bands at 20 meters and three Band 6 - Vegetation
bands at 60 meters of spatial resolution. Red Edge 0.74 20
Band 7 - Vegetation
Red Edge 0.783 20
✓ Satellite imagery, including Sentinel-2, is a Band 8 - NIR 0.842 10
valuable source of information for GIS due to Band 8A - Vegetation
Red Edge 0.865 20
frequent updates (revisit every 5 days). Band 9 - Water vapor 0.945 60
Band 10 - SWIR -
Cirrus 1.375 60
Band 11 - SWIR 1.61 20
Band 12 - SWIR 2.19 20
Source: https://sentinel.esa.int/web/sentinel/user-guides/sentinel-2-msi/overview
13
Load auxiliary vector data
14
Load vector of working area (1)
15
Load vector of working area (2)
16
Apply predefined vector style
17
Apply predefined vector style - result
18
Apply predefined vector style – result with Bing Map in the background
19
Apply predefined vector style – result with Bing Satellite in the background
20
Start using SCP plugin
21
SCP graphical interface (1)
22
SCP data provider
✓ We are going to query and browse the data catalogue of the ESA Sentinel-2 mission. This is enabled by the Copernicus
Open Access Hub which provides developers and data users with a set of API to access the imagery catalogue
✓ The API is implemented within the SCP Plugin by enabling the access to Sentinel-2 imagery data (and many others)
directly from QGIS
✓ Recently, SCP introduced access to Sentinel-2 without Copernicus Open Access Hub credentials. However, initial option
of user's authentication to access these services remained. You can create your personal account at any time here
23
SCP plugin – Image download
24
Download satellite imagery using SCP (1)
25
Download satellite imagery using SCP (2)
26
Download satellite imagery using SCP (3)
27
Download satellite imagery using SCP (4)
28
Download satellite imagery using SCP (5)
29
Download satellite imagery using SCP (6)
30
Download satellite imagery using SCP (7)
IMPORTANT NOTE
Please pay attention to the fact that, in general, when the level 2A image is available, this image
must be chosen. The level 2A image in fact is corrected by the atmospheric reflectance, on the
opposite the level 1C is not.
Level-2A products are systematically generated at the ground segment over Europe since March
2018, and the production was extended to global in December 2018.
Level-2A generation can also be performed by the user through the official SNAP tool for
atmospheric correction (see http://step.esa.int) using as input the associated Level-1C product.
This correction is the suggested one.
In the following we will show you what you can do with the SCP if you are not familiar with the
SNAP tool. Again, this is a suboptimal optimal way of making the atmospheric correction and we
suggest you learning how to do that with the ESA tool (which is something we don't have time to
show you in this workshop).
31
Download satellite imagery using SCP (8)
32
Load previously downloaded image (1)
33
Load previously downloaded image (2)
34
Download satellite imagery using SCP – results in QGIS
35
Download satellite imagery using SCP – results on local File System
36
SCP plugin – Image preprocessing
37
Satellite images preprocessing - SCP
1. Go to SCP menu
2. Select Preprocessing
3. Select Sentinel-2
38
Satellite images preprocessing - SCP – Define preprocessing type
39
Satellite images preprocessing - SCP – Define bands to be preprocessed
Definition of bands to be
preprocessed means removing
bands that we do not want to
preprocess.
We will remove bands 1, 9 and 10
from preprocessing and further
operations because they have very
low resolution – 60 m.
40
Load previously preprocessed image (1)
41
Load previously downloaded image (2)
42
Satellite images preprocessing - result
43
Remove layers from QGIS
44
SCP plugin – Band set
45
Satellite images preprocessing - SCP - Band set (1)
1. Go to SCP menu
46
Satellite images preprocessing - SCP - Band set (2)
47
Satellite images preprocessing - SCP - Band set (3)
48
Satellite images preprocessing - Virtual raster of band set (1)
49
Satellite images preprocessing - Virtual raster of band set (2)
50
Satellite images preprocessing - Virtual raster of band set (3)
51
QGIS core - Clip raster/image
52
Satellite images preprocessing – Clip (1)
53
Satellite images preprocessing - Clip (2)
Define which raster to be clipped and what is the desired extent. In this case we will clip virtual raster of
band set to the exact size of the working area polygon, and we will save output as a tif file.
1. Select virtual raster of band set from
the Input layer drop-down menu
(e.g.,
RT_L1C_T37SBR_A027817_20201019
T081242_B0virt_rast.vrt)
2. Open further options for the Clipping
extent
3. Select Use Layer Extent
4. Select working_area for reference
dataset for extent
5. Click on OK to confirm the layer
extent selection
6. Define the output file folder and
name in the Clipped (extend) field
7. Run the algorithm
54
Satellite images preprocessing - Clip (3)
NOTE:
This raster will serve as
input for supervised
classification. Save it
for the next session!
55
Satellite images preprocessing - Clip (4)
56
Satellite images preprocessing – Styling a multispectral raster layer (1)
In original Sentinel-2 image RGB is composed of bands 4, 3, 2. Since we removed band 1 during Preprocessing, and QGIS enumerated
remaining bands again, combination of bands 3, 2, 1 will create the RGB image. Reminder at this slide.
57
Satellite images preprocessing – Styling a multispectral raster layer (2)
58
SCP plugin – Band algebra
59
Band algebra - Computation of typical indexes
There are multiple algebraic operations that we can do with bands in order to obtain graphical
indexes that are useful for analysis of satellite imagery.
NDVI (Normalized Difference Vegetation Index) is the most well known and widely used index. It is a
simple, but effective index for quantifying green vegetation. The NDVI normalizes green leaf
scattering in the near-infrared wavelength and chlorophyll absorption in the red wavelength.
Therefore, the equation for NDVI involves red and near-infrared bands:
𝑁𝐼𝑅 − 𝑅𝑒𝑑
𝑁𝐷𝑉𝐼 =
𝑁𝐼𝑅 + 𝑅𝑒𝑑
Band 8 − Band 4
NDVI𝑆𝑒𝑛𝑡𝑖𝑛𝑒𝑙−2 =
Band 8 + Band 4
60
Band algebra in QGIS
61
Band algebra - SCP Band calc – how to generate an expression
62
Band algebra - SCP Band calc – NDVI expression
Band 8 − Band 4
NDVI𝑆𝑒𝑛𝑡𝑖𝑛𝑒𝑙−2 =
Band 8 + Band 4
("RT_L1C_T37SBR_A027817_20201019T081242_B08" - "RT_L1C_T37SBR_A027817_20201019T081242_B04") /
("RT_L1C_T37SBR_A027817_20201019T081242_B08" + "RT_L1C_T37SBR_A027817_20201019T081242_B04")
63
Band algebra - SCP - Computation of NDVI (1)
Following the logic of the previous two slides, compute NDVI using preprocessed bands (their name starts with “RT_”)
1. Press Refresh button to load all available
bands
2. Double-click on band name and single click on
mathematical operator to form following
expression:
("RT_L1C_T37SBR_A027817_20201019T0812
42_B08" -
"RT_L1C_T37SBR_A027817_20201019T08124
2_B04") /
("RT_L1C_T37SBR_A027817_20201019T0812
42_B08" +
"RT_L1C_T37SBR_A027817_20201019T08124
2_B04")
3. Select extent to be same as Clip layer by
checking the box Same as
4. Select Clip from the list
5. Press Run and select specify output folder and
file name
64
Band algebra - SCP - Computation of NDVI (2)
65
Non-mandatory addition: NDVI visualization
66
Band algebra - SCP – NDVI visualization (1)
67
Band algebra - SCP – NDVI visualization (2)
68
Band algebra - SCP – NDVI visualization (3)
69
Band algebra - SCP – NDVI visualization (4)
70
Band algebra - SCP – NDVI visualization - results
71
Maria Antonia Brovelli and Gorica Bratic
[email protected]; [email protected]
73