Filter by Embedded ID String in Google Earth Engine – Step-by-Step Guide

google-earth-engineland-coverspatial filter

I'm working with the Dynamic World data, which is organized into tile-date images. I want to filter the image collection by tile IDs (Copernicus tiles var tiles T46QCJ, T46QDJ, T46QDK, and T46QCK.

I cannot find a variable in the metadata containing the tile ID. Instead it appears in the ID of each image layer. I subset to one date (11-16-2015) using the ee.filter.inList fuction as follows:

var tiles = [ '20151116T043132_20151116T043131_T46QCJ', 
              '20151116T043132_20151116T043131_T46QDJ', 
              '20151116T043132_20151116T043131_T46QDK', 
              '20151116T043132_20151116T043131_T46QCK']

var dw = ee.ImageCollection('GOOGLE/DYNAMICWORLD/V1').
                 filter(ee.Filter.inList('system:index', tiles))
   

The problem with this approach is that it calls on the tile data only for a specific date defined in the ID. Is there a way to modify the filter so that the function calls on any images that include the tile ID but for different dates?

Best Answer

You can extract the tile id from the system:index property, and set it as a new property by which to filter on using your desired tiles.

code link: https://code.earthengine.google.com/00591b3b36a567f6236a92e3826fc12f