NDVI displaying using Landsat images in Google Earth Engine

Ezgi Tukel
2 min readJan 11, 2022

--

Normalized Difference Vegetation Index (NDVI) quantifies vegetation by measuring the difference between near-infrared (which vegetation strongly reflects) and red light (which vegetation absorbs). NDVI analyze whether an area contains live green vegetation or not.

This article analyzed NDVI in a case study using Google Earth Engine Landsat images.

Let’s start begin with crop the case study. With polygon tools you can create rectangle area. Turunc, Marmaris region was used in this study.

Then, I obtained Landsat Images in 2018 and 2021 to see the differences between these years.

//Landsat 8(LS8) image 2021
var landsat2021 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterBounds(ezgigeo)
.filterDate('2021-07-01','2021-09-01')
.filter(ee.Filter.lt('CLOUD_COVER', 20))
.median().select('B1','B2','B3','B4','B5','B6','B7').clip(ezgigeo);
//print('LS8: ',landsat2021);
Map.addLayer(landsat2021,{min:0, max:4000, bands:['B4','B3','B2']},'landsat2021', 1);
//Landsat 8(LS8) image 2018
var landsat2018 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterBounds(ezgigeo)
.filterDate('2018-07-01','2018-09-01')
.filter(ee.Filter.lt('CLOUD_COVER', 20))
.median().select('B1','B2','B3','B4','B5','B6','B7').clip(ezgigeo);
//print('LS8: ',landsat2018);
Map.addLayer(landsat2018,{min:0, max:4000, bands:['B4','B3','B2']},'landsat2018', 1);
Landsat images of case study

To see differences in vegetation index these years, I calculated NDVI.

// Compute NDVI 
var ndvi2021 = landsat2021.normalizedDifference(['B3','B4']);
var ndvi2018 = landsat2018.normalizedDifference(['B3','B4']);
//NDVI mapping
var NDVI_Palette = '#369121, #95c769, #2943d6, #d6a321, #ff2978';
Map.addLayer(ndvi2021, {min: -0.1, max: 1, palette: NDVI_Palette}, "NDVI 2021");
Map.addLayer(ndvi2018, {min: -0.1, max: 1, palette: NDVI_Palette}, "NDVI 2018");
// Compute the multi-band difference image.
var diff = ndvi2018.subtract(ndvi2021);
Map.addLayer(diff, {min: -1, max: 1, palette: NDVI_Palette}, "Difference NDVI", false);// export
Export.image.toDrive({
image : ndvi2021,
description : 'NDVI2021',
scale : 10,
region : ezgigeo,
maxPixels : 1e9
})
NDVI analysis of 2018
NDVI analysis of 2021

As you see above, vegetation diversity is in 2018 more than in 2021. Forest fires can cause reduced this diversity in summer of 2021.

You can calculate different indexes with Google Earth Engine codes such as water index(NDWI), moisture index(NDMI).

See you next studies, I hope its benefits for you..

--

--

Ezgi Tukel

PhD candidate who loves reading, discovering and cities