0

I have a FeatureCollection of Features (zonstats_reduced) that I obtained after Reduce Regions based on Sentinel mosaics. I have created daily Sentinel mosaics for the years 2017-2019. Each feature has the statistics and date (img:id) in properties which were copied from the Sentinel data earlier. I would like to create a separate FeatureCollection for each date (one day=one FeatureCollection), but my FeatureCollections are empty despite filtering by the created list of daily mosaic dates.

var imlist1 = s2index.toList(s2index.size());
var uni_dates = imlist1.map(function(d){
    return ee.Image(d).date().format("YYYY-MM-dd");
}).distinct();
print('list of features for each date', uni_dates);

var new_colls = uni_dates.map(function(n){
  var coll =  zonstats_reduced.filter(ee.Filter.eq('img:id', ee.String(ee.Number(n))));
  return ee.FeatureCollection(coll);
});
print(new_colls);

enter image description here

1 Answer 1

0

Those are most likely not empty, they're just not recursively expanded in the print. Try printing the size of one explicitly.

print(ee.FeatureCollection(new_colls.get(0)).size())

By the way, your dates are not numbers, they're strings, so the ee.Number inside the last map isn't correct (you don't need the ee.String cast either). It doesn't seem to be hurting anything, but it shouldn't be there.

1
  • Thank you Noel, you're right, they are not empty. Your answer helped me.
    – typowao
    Feb 22, 2023 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.