I am new to Google Earth Engine. I managed to produce NDVI on the map window from 6 Landsat tiles from median values .median(). With the .first() I managed to export it but with the median() I get several tif files without data. What is the problem? Here is the code I used.

// var surfaceReflectanceL5 = ee.ImageCollection('LANDSAT/LT05/C01/T1_SR');
var img = ee.Image(ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
    .filterDate('2018-01-01', '2018-12-31')
Map.addLayer(img, {bands: ['B5', 'B4','B3'],min:0, max: 3000}, 'True colour image');

// Use the normalizedDifference(A, B) to compute (A - B) / (A + B)
var ndvi = img.normalizedDifference(['B5', 'B4']);

// Make a palette: a list of hex strings.
var palette = ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718',
               '74A901', '66A000', '529400', '3E8601', '207401', '056201',
               '004C00', '023B01', '012E01', '011D01', '011301'];

// Display the input image and the NDVI derived from it.
Map.addLayer(img.select(['B5', 'B4', 'B3']),
         {gain: [0.1, 0.1, 0.1]});
Map.addLayer(ndvi, {min: 0, max: 1, palette: palette}, 'NDVI');

// the problem is here: why it is exporting several layers without data (sizes less than 200kb)
// Export the image, specifying scale and region.
  image: ndvi,
 description: 'NDVI_2018_A1',
 scale: 30,
 region: roi

1 Answer 1


I am not exactly sure on what it does but after I used the reduce command, I managed to export my several NDVI tiles all at once with the NDVI scale I wanted. Hope someone with good skill will comment/confirm on this.

// reduce
var reducedNDVI = ndvi.reduce(ee.Reducer.median())

// Export the image, specifying scale and region.

     image: reducedNDVI,
     description: 'NDVI_2018_All',
     scale: 30,
     region: roi

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.