I am trying to batch download an image collection using Rodrigo E. Principe's tool but I want to download each band seperately by image.select function.
When I download a single band, I get the name of the image, but I want to add name of the band to the image id.
Example of the id I get while downloading band 'B4': 20190731T083609_20190731T084610_T36TVK
Want I want to achieve while downloading band 'B4': 20190731T083609_20190731T084610_T36TVK_B4
This is the code I use for download.
var tile = ee.Geometry.MultiPolygon((([31.8168273934012,40.644794803776],[31.8338683044504, 39.655752572233],[33.1137799145259 ,39.6615512269476],[33.1154430676193, 40.6507988109166])))
var geom= ee.Geometry.Rectangle([31.5, 40.4, 33.1, 39.4])
// Load the Sentinel-2 ImageCollection.
var sentinel2 = ee.ImageCollection("COPERNICUS/S2");
//ImageCollection filtered by date and region
var filtered = ee.ImageCollection(sentinel2
.filterDate("2019-07-27", "2019-08-03").filterBounds(geometry));
Map.addLayer(filtered, {bands: ['B4', 'B3', 'B2'], max: 2000}, 'filtered')
Map.centerObject(filtered)
//Clip layer
Map.addLayer(table,{},'140bin')
//clipping Function
var clipimage = function(image) {
return image.clip(table);
};
//Function to Select band
var redband =function(image){
return image.select('B4')
}
//Select band to download
var red = filtered.map(redband)
Map.addLayer(red,{ max: 2000}, 'red')
Map.centerObject(filtered)
//how many images
var count = filtered.size()
print("Count", count)
//Single Band Batch Download
batch.Download.ImageCollection.toDrive(filtered, '140binclip', {scale: 10, region: geom.getInfo()})```