先将featureCollection的某个属性(e.g. id or code)存放到一个list里
/*
**@Author:
* Prophet.Z, 10 Dec 2020
* *Wuhan University**
*/
function exportPointsCollection(AllGridImageCol){
var indexList = AllGridImageCol
//.filter(ee.Filter.gte('code',2535))
.reduceColumns(ee.Reducer.toList(),['code']).get('list');
print('indexList',indexList)
//print('indexList.length',ee.List(indexList).size())
indexList.evaluate(function(indexs){
for (var i=0;i<indexs.length;i++){
//get each imageCollection in the FeatureCollection
var oneGrid= AllGridImageCol.filter(ee.Filter.eq('code',indexs[i])).first();
print('oneGrid',oneGrid);
//export
Export.table.toDrive({
collection:oneGrid,
description:'landsat'+indexs[i],
folder:'landsat',
selectors:(['year','ndvi'])
//export the property of each features in one imageCollection
})
}
})
}
exportPointsCollection(AllGridImageCol);