1

I am working with Google Earth Engine Code Editor. I am trying to load a collection of Sentinel-2 images as shown below:

var s2RawData = ee.ImageCollection("COPERNICUS/S2_SR")
    .filterMetadata('CLOUDY_PIXEL_PERCENTAGE', 'less_than', 75)
    .filterDate('2018-10-01', '2019-03-31')
    .filterBounds(geometry);

I get an image collection with images in different tiles (30TYL, 31TBE, 30TYK, 31SBD, 30SYJ). However I want only the images in tiles 30TYL and 30TYK. If I filter a single tile, my code works correctly, as shown here:

var s2RawData = ee.ImageCollection("COPERNICUS/S2_SR")
    .filterMetadata('CLOUDY_PIXEL_PERCENTAGE', 'less_than', 75)
    .filterDate('2018-10-01', '2019-03-31')
    .filterBounds(geometry)
    .filterMetadata('MGRS_TILE', 'EQUALS','30TYL');

But it does not work when I pass a list of tiles to it:

var s2RawData = ee.ImageCollection("COPERNICUS/S2_SR")
    .filterMetadata('CLOUDY_PIXEL_PERCENTAGE', 'less_than', 75)
    .filterDate('2018-10-01', '2019-03-31')
    .filterBounds(geometry)
    .filterMetadata('MGRS_TILE', 'EQUALS', ['30TYL', '30TYK']);

Filtering with ee.Filter.or does not work either. You only get the images in the 30TYL tile.

var s2RawData = ee.ImageCollection("COPERNICUS/S2_SR")
    .filterMetadata('CLOUDY_PIXEL_PERCENTAGE', 'less_than', 75)
    .filterDate('2018-10-01', '2019-03-31')
    .filterBounds(geometry)
    .filter(ee.Filter.or(ee.Filter.eq('MGRS_TILE', '30TYL'), ee.Filter.eq('MGRS_TILE', '30TTYK')))

1 Answer 1

1

Finally, this worked using ee.Filter.inList:

var tiles = ['30TYL', '30TTYK'];

var s2RawData = ee.ImageCollection("COPERNICUS/S2_SR")
    .filterMetadata('CLOUDY_PIXEL_PERCENTAGE', 'less_than', 75)
    .filterDate('2018-10-01', '2019-03-31')
    .filterBounds(geometry)
    .filter(ee.Filter.inList('MGRS_TILE', tiles));

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.