I am new to GEE and now I need to filter and sort a sentinel 2 data collection by cloud coverage. Basically, I need the Ecuador tile with "T17MNT" in its id in image properties. I figure out the workflow should be something like the following, but I still have issues with the Filter.

  1. How do I use a wildcard in gee?

There are lots of images but I just want those that have "T17MNT" in "PRODUCT_ID". T17MNT stands for the granule identifier in Eduador. EE asset ids for Sentinel-2 L2 assets have the following format: COPERNICUS/S2_SR/20151128T002653_20151128T102149_T56MNN. The final 6-character string is a unique granule identifier. But other digits are dates and times and I don't want them in my filter. I assume the wildcard is something like "?T17MNT?".

  1. This is the link to the sentinel 2 dataset. See "image properties" tab. "PRODUCT_ID" might not be the correct field that contains the long name described above. but please ignore that for now, or let me know the correct one.

This is the error I receive.

ImageCollection (Error)
Filter.inList: Cannot filter using 'ListContains' with 'T17MNT' as a left operand.

This is the code I am using.

var dataset = ee.ImageCollection('COPERNICUS/S2_SR')
                  .filterDate('2020-05-23', '2020-10-25')
                  .filter(ee.Filter.lte('CLOUDY_PIXEL_PERCENTAGE', 16))
                  .filter(ee.Filter.inList('PRODUCT_ID', 'T17MNT'))
                  .sort('CLOUDY_PIXEL_PERCENTAGE', false)

2 Answers 2


You ee.Filter.inList() requires the filter value to be a List. When reaching an error it helps to read the documentation to see what your input format should be. To answer your question it can look like this:

    .filter(ee.Filter.inList('PRODUCT_ID', ee.List(['T17MNT'])))

But that doesn't result in an image so I guess you need to use a different property that defines the tiles you are searching for, not sure but perhaps check out options like this:

.filter(ee.Filter.eq('MGRS_TILE', '21NXG'))
.filterBounds(geometry) // ==> filter on a geometry

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.