I loaded multiple images from Landsat 5 and Landsat 7 onto my Google Earth engine, from 1988 until 2022 for my region of interest. I'm trying to export these images individually to Google Drive as GeoTIFF files. I'm a little stuck on how to do so. Here is my code:
var cloudMaskL457 = function(image) {
var qa = image.select('pixel_qa');
var cloud = qa.bitwiseAnd(1 << 5)
.and(qa.bitwiseAnd(1 << 7))
.or(qa.bitwiseAnd(1 << 3));
var mask2 = image.mask().reduce(ee.Reducer.min());
return image.updateMask(cloud.not()).updateMask(mask2);
};
var l5 = ee.ImageCollection('LANDSAT/LT05/C01/T1_SR')
.filterDate('1984-01-01', '2011-12-31')
.map(cloudMaskL457)
.filterBounds(aoi)
.map(function(a){
return a.set('year', ee.Image(a).date().get('year'))
})
var l7 = ee.ImageCollection('LANDSAT/LE07/C01/T1_SR')
.filterDate('2012-01-01', '2022-12-31')
.map(cloudMaskL457)
.filterBounds(aoi)
.map(function(a){
return a.set('year', ee.Image(a).date().get('year'))
})
var list = ee.List([])
for(var a=1984; a < 2023; a++) {
if(a < 2012) {
var fill5 = l5.filterMetadata('year', 'equals', a).median()
var l5final = fill5.set('year', a)
.set('product', 'l5')
list=list.add(l5final)
} else {
var fill7 = l7.filterMetadata('year', 'equals', a).median()
var l7final = fill7.set('year', a)
.set('product', 'l7')
list=list.add(l7final)
}
print(list)
var finalCol = ee.ImageCollection(list).map(function(a) {
return a.set('bands', ee.Image(a).bandNames().length())
})
.filterMetadata('bands','equals', 11)
print(finalCol)
for(var a = 1988; a < 2023; a++) {
Map.addLayer(finalCol.filterMetadata('year', 'equals', a), imageVisParam, 'Year'+' '+a, false)
}