Calculate NDVI from Sentinel 2 and reclassify in QGIS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video i'm going to demonstrate how to calculate ndvi from a sentinel 2 image and how to reclassify the result into vegetation classes we can download sentinel data from different websites here i use the usgs earth explorer website and you start by indicating the area you can move the map to the study area and you can use use map and then it will make a little polygon for that area and that will be the search area in this case i'm not interested in that area you could also put coordinates or you can click to get a polygon but what i'm going to do is to upload a zipped shapefile with a boundary polygon and here i have the boundary and then i can choose a date range let's say from 2020 april to 2021 first of april i go to datasets and here i can go to the sentinel and choose sentinel 2 and then i can go to results and there you can check the footprint you can check the metadata or you can download after logging in i'm logged in and to have the full image it's in the jpeg 2000 format you choose this one if you just want a picture you choose the geotiff so in our case we would use that one after choosing the correct one which has the least clouds etc after downloading and unzipping the file i find these folders and the data can be found under granule and then the name of the tile and define it here under img underscore data and i'm interested in all these raster bands so i'm going to select them and drag them to the map canvas and here we see them and we can see that they are already projected to utm zone 31 north and that they have pixel size in this case for this band of 60 meters and this band has a 10 meter resolution so i'm going to make a map stack out of this to create a multi-band raster and i don't need a band 8a so i'll just remove it and the quickest way to make a multiband raster of these individual bands is to make a virtual layer so go to raster miscellaneous build virtual roster here i can select the input bands select them all click ok and you can choose here which resolution you want for the output and let's take the highest resolution so the 10 meter and make sure that it puts each layer into a separate band if you have this unchecked it will mosaic tiles which are distributed in space but in our case they're of course stacked on top of each other therefore we check this box and we keep the other things as default and then i save it to a file then i run it and this is very quick as you can see so i remove all the previous layers and there we have our multiband raster so we can use the layer styling panel and it recognizes a multi-band color and here i can choose for example to have near infrared band 8 visualized in red the green band in band 4 the red and the blue band are 3 and here we see that all the red parcels are vegetated we can distinguish the forests etc so you can play with these different band settings to see different features in the landscape and we are going to use this now to calculate the ndvi so what i do i go to raster roster calculator and here we see all the bands and ndvi is for sentinel is the near infrared is band eight so this add symbol separates the name of the layer with the band name so this band number eight minus the near infrared minus the red so that is band four divided by the near infrared plus red let's save it let's call this one ndvi dot diff and we run it there it is with values between -1 and 1. let's style the layer the ndvi single band pseudo color and let's choose greens and here we see that the more green it is the more vegetation you can play with these settings to get more contrast if we want to know which areas are vegetated and which are not vegetated we can simply separate them using the raster calculator because ndvi values that are larger than zero are considered vegetation so we create a boolean layer and we call this vegetated dot diff and then i run it and there it is and i use palette at unique values and i say classify and then we can make the zeros blue and the vegetation green and here we see that it's not very informative but we can get the lakes out of this so let's make some more classes and we do that by going to the processing toolbox and use reclassify by table and we take the ndvi and we can make a table where we say from -1 to 0 it will be no vegetation call it class 0 because i can only store values in rasters from 0 to 0.1 let's call it bare little vegetation but i can only put values there 0.1 to 0.25 it's like a medium dense 0.25 to 0.4 and 0.4 to 1. click ok and i want the lower value to be part of the range and higher value not to be part of the range and let me choose here the integer 16 because we have some node data there that we want to use i save this to a tiff file i call this vegetation classes there we have it let's also style this layer palleted unique values classify here we are and then i'm also going to use greens and this gives us a nice classification of the area in terms of vegetation cover i can change this like no vegetation bare low vegetation cover medium vegetation cover there we are
Info
Channel: Hans van der Kwast
Views: 30,883
Rating: undefined out of 5
Keywords: QGIS, NDVI, Sentinel, Remote Sensing, Virtual Raster, multiband raster, raster calculator, reclassify, raster
Id: EaC5sQpExjg
Channel Id: undefined
Length: 10min 6sec (606 seconds)
Published: Fri Apr 16 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.