I have an image collection which I want to filter iteratively using a list of tile id's to get the images corresponding to each tile id.

So, I basically want to find an alternative for this code using a for loop or map() function:

var id_tile = ee.List(['17RNJ','17RLH','17RMJ','17RMK']);

var Collection1 = MyImageCollection.filter(ee.Filter.equals('MGRS_TILE',id_tile.get(0)));
var Collection2 = MyImageCollection.filter(ee.Filter.equals('MGRS_TILE',id_tile.get(1)));
var Collection3 = MyImageCollection.filter(ee.Filter.equals('MGRS_TILE',id_tile.get(2)));
var Collection4 = MyImageCollection.filter(ee.Filter.equals('MGRS_TILE',id_tile.get(3)));

I don't know whether is possible to return a collection of collections using the map() function or I have to do this manually as the example above.

1 Answer 1


Use ee.Filter.inList():

var id_tile = ['17RNJ','17RLH','17RMJ','17RMK'];
var filter = ee.Filter.inList('MGRS_TILE', id_tile);
var Collection = MyImageCollection.filter(filter);
  • Thank you for your answer, but it is not doing what I am expecting. This is like a feature collection containing several image collections. In this case is an image collection per each id_tile element and contained all in a single (feature?) collection, but I think it is not possible in GEE... Commented May 9, 2020 at 21:08

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.