I would like to export raster in a foreach loop with :
var landCover = ee.Image('MODIS/006/MCD12Q1/2016_01_01').select('LC_Prop1');
var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017');
var Country_array = ['Kenya', 'Senegal',
'Mozambique', 'Comoros',
'France', 'Cambodia',
'Colombia','Gabon'];
Country_array.forEach(function(c) {
print(c);
var sel = countries.filter(ee.Filter.eq('country_na', c));
var modis2017 = ee.Image(landCover)
.clip(sel);
Export.image.toDrive({
image : modis2017,
description: 'image'.concat('_', c),
//maxPixels: 3784216672400,
scale: 1000,
crs : 'EPSG:4326',
fileFormat: 'GeoTIFF'
});
// display
Map.addLayer(sel, {}, 'shp'.concat('_', c));
Map.addLayer(modis2017, {}, 'r'.concat('_', c));
});
but it produces empty (black) images. I don't understand why.