Is it possible to use an equality filter for a FeatureCollection in GEE based on multiple values? I understand how to filter by one value:
collectionName.filter(ee.Filter.eq('COLUMN','VALUE'));
But what if I wanted to filter by a list of values? Something like:
var lis = ee.List(['VALUE1', 'VALUE2', 'VALUE3']);
Is it possible to apply this to equality filter? I tried to do the following:
collectionName.filter(ee.Filter.eq('COLUMN',lis));
It ran, but didn't work.
Best Answer
The
inList
filter is what you want for looking for any value in a list:If instead you want to use several filters (so that you can use other conditions than equality, or multiple properties), you can use
ee.Filter.or
:This is the same as the first filter but can be changed to look at different properties, for example. If you already have a simple list of values,
inList
is the right tool.