公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
ee.ImageCollection.iterate
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
將使用者提供的函式套用至集合的每個元素。使用者提供的函式會收到兩個引數:目前的元素,以及前一次呼叫 iterate() 傳回的值,或第一次疊代的引數。結果是最後一次呼叫使用者提供的函式時傳回的值。
傳回 Collection.iterate() 呼叫的結果。
用量 | 傳回 |
---|
ImageCollection.iterate(algorithm, first) | ComputedObject |
引數 | 類型 | 詳細資料 |
---|
這個:collection | 集合 | Collection 執行個體。 |
algorithm | 函式 | 要套用至每個元素的函式。必須採用兩個引數:集合的元素和前一次疊代的值。 |
first | 物件 (選用) | 初始狀態。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003eApplies a custom function iteratively to each element of a collection, using the previous result in each subsequent calculation.\u003c/p\u003e\n"],["\u003cp\u003eReturns the final computed value after applying the function across all elements.\u003c/p\u003e\n"],["\u003cp\u003eBegins with an initial state (optional) and updates it based on the user-provided function and each element in the collection.\u003c/p\u003e\n"],["\u003cp\u003eUseful for implementing custom algorithms or calculations across collections like ImageCollections.\u003c/p\u003e\n"]]],["`iterate()` applies a user-defined function to each collection element. This function receives the current element and the prior iteration's result as arguments. The process starts with an optional initial state (`first`). The final output is the value produced by the user-defined function's last execution. It's used on a `Collection` with the `algorithm` being a function and `first` as optional. It returns a `ComputedObject`.\n"],null,["# ee.ImageCollection.iterate\n\n\u003cbr /\u003e\n\nApplies a user-supplied function to each element of a collection. The user-supplied function is given two arguments: the current element, and the value returned by the previous call to iterate() or the first argument, for the first iteration. The result is the value returned by the final call to the user-supplied function.\n\n\u003cbr /\u003e\n\nReturns the result of the Collection.iterate() call.\n\n| Usage | Returns |\n|-------------------------------------------------|----------------|\n| ImageCollection.iterate`(algorithm, `*first*`)` | ComputedObject |\n\n| Argument | Type | Details |\n|--------------------|------------------|-----------------------------------------------------------------------------------------------------------------------------------------|\n| this: `collection` | Collection | The Collection instance. |\n| `algorithm` | Function | The function to apply to each element. Must take two arguments: an element of the collection and the value from the previous iteration. |\n| `first` | Object, optional | The initial state. |"]]