1

I am trying to filter a Sentinel-2 collection by the system:index property. I have selected three specific tiles identified by its respective id, then tried filtering them from a collection using filter(ee.Filter.eq()) function, but it does not load any image. It works well for filtering only one image id, but is not working with several at the same time.

var tiles = [
  '20190129T160521_20190129T161214_T17RMN',
  '20190106T160511_20190106T160506_T17RNJ',
  '20190106T160511_20190106T160506_T17RNK'
]

var filtered = ee.ImageCollection('COPERNICUS/S2')
  .filter(ee.Filter.eq('system:index', tiles))

print(filtered.size());

https://code.earthengine.google.com/51da7be720dd9e67e9e32fa3c6fafb85?noload=true

I appreciate any help.

Best,

Luis

3

You can simply use the ee.Filter.inList() filter:

var tiles = [
  '20190129T160521_20190129T161214_T17RMN',
  '20190106T160511_20190106T160506_T17RNJ',
  '20190106T160511_20190106T160506_T17RNK'
]

var filtered = ee.ImageCollection('COPERNICUS/S2')
  .filter(ee.Filter.inList('system:index', tiles))

print(filtered.size());
1
  • 1
    That work, thank you! Apr 17 '20 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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