公告:凡是在 
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取。如未在 2025 年 9 月 26 日前完成驗證,存取權可能會暫停。
  
        
 
       
     
  
  
  
    
  
  
  
    
      ee.List.filter
    
    
      
    
    
      
      透過集合功能整理內容
    
    
      
      你可以依據偏好儲存及分類內容。
    
  
  
      
    
  
  
  
  
  
    
  
  
    
    
    
  
  
會篩選清單,只保留符合指定篩選條件的元素。如要篩選非圖片或地圖項目的清單項目,請測試名為「item」的屬性,例如 ee.Filter.gt('item', 3)。
| 用量 | 傳回 | 
|---|
| List.filter(filter) | 清單 | 
| 引數 | 類型 | 詳細資料 | 
|---|
| this: list | 清單 |  | 
| filter | 篩選器 |  | 
  
  
  範例
  
    
  
  
    
    
  
  
  
  
    
    
    
      程式碼編輯器 (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))));
  
    
  
  
    
  
  
  
  
    
  
    
  Python 設定
  請參閱「
    Python 環境」頁面,瞭解 Python API 和如何使用 geemap 進行互動式開發。
  import ee
import geemap.core as geemap
  
    
    
      Colab (Python)
    
    
  # An ee.Image list object.
ee_list = ee.List([1, 2, 3, None, 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.
display('List items equal to 3:',
        ee_list.filter(ee.Filter.eq('item', 3)))
display('List items greater than 4:',
        ee_list.filter(ee.Filter.gt('item', 4)))
display('List items not None:',
        ee_list.filter(ee.Filter.notNull(['item'])))
display('List items in another list:',
        ee_list.filter(ee.Filter.inList('item', [1, 98, 99])))
display('List items 3 ≤ 𝑥 ≤ 6:',
        ee_list.filter(ee.Filter.And(
            ee.Filter.gte('item', 3),
            ee.Filter.lte('item', 6))))
  
  
  
  
  
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
  上次更新時間:2025-10-30 (世界標準時間)。
  
  
  
    
      [null,null,["上次更新時間:2025-10-30 (世界標準時間)。"],[],["The `List.filter(filter)` method filters a list, returning a new list containing only elements that match the provided filter.  Elements are referenced by the property name 'item' within `ee.Filter` functions.  Filters can test for equality (`eq`), greater than (`gt`), not null (`notNull`), inclusion in another list (`inList`), and combined conditions using `and`. Examples show how to filter numerical lists in both JavaScript and Python using these comparison operations.\n"]]