5

I used the code snippet below to filter a Sentinel-2 S2_SR collection by metadata (S-2 Tile). This snippet helped me to obtain imagery that covers the Tile 32UQC. Now I would like to get a Sentinel-2 Collection for the following Tiles:

  • 32UPU
  • 32UPV
  • 32UQU
  • 32UQV
  • 33UUP
  • 33UUQ

Does anyone know how to deal with this task? Or should I repeat the <Collection>.filterMetadata method for every Tile I listed above?

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Finding images in the Sentinel2 L2A Collection 
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

var s2_2018_03_01TO2018_03_31 = ee.ImageCollection("COPERNICUS/S2_SR")
  .filterMetadata('MGRS_TILE', 'equals', '32UQC')
  .filterDate('2018-03-01', '2018-03-31')
  .filter(ee.Filter.lte('CLOUDY_PIXEL_PERCENTAGE', 50));
5

You can use an ee.Filter.inList() filter.

var tiles = ['32UQC', '32UPU', '32UPV', '32UQU', '32UQV', '33UUP', '33UUQ']
var s2_2018_03_01TO2018_03_31 = ee.ImageCollection("COPERNICUS/S2_SR")
  .filter(ee.Filter.inList('MGRS_TILE', tiles))
  .filterDate('2018-03-01', '2018-03-31')
  .filter(ee.Filter.lte('CLOUDY_PIXEL_PERCENTAGE', 50));
1
  • Thanks Daniel! It worked! – almrog Apr 1 '20 at 12:37

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.