0

I am new to Google Earth Engine and satellite imagery in general. My goal is to export bands B1-B7 from the [Landsat 8 image collection][2] over a given geometry and be able to visualize each band (or combination of bands) in a jupyter notebook. However, I am only able to export the median of my geometry in order to convert the image collection to an image. How can I export my geometry in a way that doesn't capture the median of each band?

/**
 * Function to mask clouds based on the pixel_qa band of Landsat 8 SR data.
 * @param {ee.Image} image input Landsat 8 SR image
 * @return {ee.Image} cloudmasked Landsat 8 image
 */
function maskL8sr(image) {
  // Bits 3 and 5 are cloud shadow and cloud, respectively.
  var cloudShadowBitMask = (1 << 3);
  var cloudsBitMask = (1 << 5);
  // Get the pixel QA band.
  var qa = image.select('pixel_qa');
  // Both flags should be set to zero, indicating clear conditions.
  var mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0)
                 .and(qa.bitwiseAnd(cloudsBitMask).eq(0));
  return image.updateMask(mask);
}

var dataset = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
                  .filterDate('2016-01-01', '2016-12-31')
                  .map(maskL8sr);
                  
var landsat8 = dataset.median().clip(polygon);

var visParams = {
  bands: ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7'],
  min: 0,
  max: 3000,
  gamma: 1.4,
};
Map.setCenter(13.534922,-12.350257, 16);
Map.addLayer(landsat8.median(), visParams);

Export.image.toDrive({
  image: landsat8,
  scale: 30
})
1

The image that you are exporting is the median of your Landsat collection.

Exporting from earth engine can only be done one image at a time.

You could write a loop in javascript to export each of the images individually inside the loop.

See this answer by Rodrigo Principe on how to do it.

Export each image from a collection in Google Earth Engine

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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