I need to create image collection of NDWI for a polygon I have from 1983-2019. For that, I want to use different Landsat image collection. I saw that there is made a product in Google Earth Engine that gives the NDWI values, but I face few problems, the first one is that I want to represent and download the whole image collection, and the second is that whenever I try to represent even one image I don't see anything. I tried also to represent only one but I still see nothing.

This is the code I wrote.

// create image collections for the years 1983-2019 

//Landsat 4 
var dataset = ee.ImageCollection('LANDSAT/LT04/C01/T1_8DAY_NDWI')
                  .filterDate('1983-01-01', '1984-12-31')
print('dataset: ', dataset);

// Get the number of images Landsat4
var count = dataset.size();
print('Count: ',count);

// Sort by a cloud cover property, get the least cloudy image- why does it rank the images? do they still have clouds?
var image = ee.Image(dataset.sort('CLOUD_COVER').first());
print('Least cloudy image: ', image);

var colorized = dataset.select('NDWI');
var colorizedVis = {
  min: 0.0,
  max: 1.0,
  palette: ['0000ff', '00ffff', 'ffff00', 'ff0000', 'ffffff'],
Map.addLayer(colorized, colorizedVis, 'Colorized');

  • I don't know where your study area is ("table"), but there is quite limited data present in 1984, mainly restricted to the USA link code
    – Kuik
    Commented Jun 24, 2019 at 11:56
  • it's in Africa, Nigeria
    – ReutKeller
    Commented Jun 24, 2019 at 12:03

1 Answer 1


As @kuik says, data in early 1980 is limited to the US, so is hard to find data out these limits before 1990.

Also .filterBounds(table) is not useful in this kind of data, because is a global composite product. So I don't recommend you to download the whole collection.

A workaround is working with Collection-1, filter bounds, compute NDWI and download products. To compute NDWI use:

var NDWI = function(img){
  var result = img.normalizedDifference(['B4','B5']).rename('NDWI');
  return result.copyProperties(img);

//Landsat 4 
var dataset = ee.ImageCollection("LANDSAT/LT04/C01/T1_TOA")
                  .filterDate('1983-01-01', '1984-12-31')
print('dataset: ', dataset);

But, sadly, you will find no images in Africa in this date range

  • sorry for the question but do you know why there are no images from that time? Do you have any idea how can I get images of Africa from this date range?
    – ReutKeller
    Commented Jun 24, 2019 at 14:54
  • 1
    1) For technical reasons (check: landsat.usgs.gov/sites/default/files/documents/…). 2) You can try with glovis.usgs.gov
    – aldo_tapia
    Commented Jun 24, 2019 at 15:49
  • so if I don't see the images, but do get data about them (like how many images are and more), can I still run statistics on them? I need the mean NDWI vaue or the whole image
    – ReutKeller
    Commented Jun 27, 2019 at 8:56

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.