ee.List.filter

Filters a list to only the elements that match the given filter. To filter list items that aren't images or features, test a property named 'item', e.g.: ee.Filter.gt('item', 3)
UsageReturns
List.filter(filter)List
ArgumentTypeDetails
this: listList
filterFilter

Examples

Code Editor (JavaScript)

// An ee.Image list object.
var list = ee.List([1, 2, 3, null, 6, 7]);

// Filter the list by a variety of conditions. Note that the property name
// 'item' is used to refer to list elements in ee.Filter functions.
print('List items equal to 3',
      list.filter(ee.Filter.eq('item', 3)));
print('List items greater than 4',
      list.filter(ee.Filter.gt('item', 4)));
print('List items not null',
      list.filter(ee.Filter.notNull(['item'])));
print('List items in another list',
      list.filter(ee.Filter.inList('item', [1, 98, 99])));
print('List items 3 ≤ 𝑥 ≤ 6',
      list.filter(ee.Filter.and(
        ee.Filter.gte('item', 3),
        ee.Filter.lte('item', 6))));