I am trying to download Landsat 5 Band 6 using Google Earth Engine
. When I run the code I am getting the following error: Error: Invalid argument: 'image' must be of type Image
. I found on this post that I was trying to export an ImageCollection
instead of a single image. I also found this post but the getDownloadURL
is not working. I would like to ask, because I am new to GEE
how can I download a single band? Below it's the code:
var sub_geom = region.geometry();
var sub_region = JSON.stringify(sub_geom.bounds(1).getInfo().coordinates);
Map.addLayer(sub_geom);
var cloudMaskL457 = function(image) {
var qa = image.select('pixel_qa');
// If the cloud bit (5) is set and the cloud confidence (7) is high
// or the cloud shadow bit is set (3), then it's a bad pixel.
var cloud = qa.bitwiseAnd(1 << 5)
.and(qa.bitwiseAnd(1 << 7))
.or(qa.bitwiseAnd(1 << 3));
// Remove edge pixels that don't occur in all bands
var mask2 = image.mask().reduce(ee.Reducer.min());
return image.updateMask(cloud.not()).updateMask(mask2);
};
//Import Landsat Image
var L7200508NDVI = ee.Image(ee.ImageCollection('LANDSAT/LT05/C01/T1_SR')
.filterDate('1995-01-01', '1995-01-31')
.map(cloudMaskL457)
.filterBounds(sub_geom)
.mean());
// Export the image, specifying scale and region.
Export.image.toDrive({
image: L7200508NDVI,
description: 'imageToDriveExample',
scale: 120,
region: sub_geom
});
L7200508NDVI.select("B6")
to get band 6.L7200508NDVI.select("B6")
? Thank you