公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
ee.Reducer.forEachElement
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
分別減少形狀相同的陣列輸入中的每個位置,產生形狀相同的陣列輸出。
舉例來說,如果對 5 個形狀為 2x2 的陣列套用「sum」縮減器,輸出內容會是 2x2 陣列,其中每個位置都是該位置的 5 個值總和。
用量 | 傳回 |
---|
Reducer.forEachElement() | 縮減函式 |
引數 | 類型 | 詳細資料 |
---|
這個:reducer | 縮減函式 | 要套用至每個陣列元素的縮減器。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003eApplies a reducer function to corresponding elements across multiple arrays of the same shape.\u003c/p\u003e\n"],["\u003cp\u003eOutputs a single array mirroring the input shape, with each element representing the reduced value of corresponding input elements.\u003c/p\u003e\n"],["\u003cp\u003eOffers flexibility through the \u003ccode\u003eforEachElement\u003c/code\u003e method to specify the reducer function.\u003c/p\u003e\n"],["\u003cp\u003eIllustrated with an example using the 'sum' reducer to aggregate values across five 2x2 arrays into a resultant 2x2 array.\u003c/p\u003e\n"]]],[],null,["# ee.Reducer.forEachElement\n\nSeparately reduces each position in array inputs of equal shape, producing an array output of the same shape.\n\n\u003cbr /\u003e\n\nFor example, with the 'sum' reducer applied to 5 arrays with shape 2x2, the output will be a 2x2 array, where each position is the sum of the 5 values at that position.\n\n| Usage | Returns |\n|----------------------------|---------|\n| Reducer.forEachElement`()` | Reducer |\n\n| Argument | Type | Details |\n|-----------------|---------|---------------------------------------------|\n| this: `reducer` | Reducer | The reducer to apply to each array element. |"]]