1

I am trying to calculate NDVI for each month and masking NDVI images with lte(0) filter to identify water bodies and show the timelapse between encroachment area of waterbodies in different years and calculate the encroachment area between each year. But I am not able to add all the NDVI images of different years to the map. Here is the link to my code:

https://code.earthengine.google.com/eac8b5f4b0d1e30fc853ffd8bdb8be96

Here is my code:

var start = ee.Date.fromYMD(2014,1,01);
var end = ee.Date.fromYMD(2019,12,31).advance(1,'month');
var date_range = ee.DateRange(start,end);
var S3Month = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterDate(date_range)
.filterBounds(roi)
.map(function(img){
   return img.clip(roi).select().addBands(img.normalizedDifference(['B5', 'B4']).lte(0))});
 print(S3Month);

 Map.addLayer(S3Month, {min:-1, max: 1}, 'mm')
 Map.centerObject(roi,10); 
 var listOfImages = S3Month.toList(20).getInfo();
 for (var i = 0; i <listOfImages.length; i++) {
  var img = listOfImages[i];
  Map.addLayer(ee.Image(img.id),{},img.id);
}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.