Announcement: All noncommercial projects registered to use Earth Engine before
April 15, 2025 must
verify noncommercial eligibility to maintain Earth Engine access.
ee.Reducer.forEachElement
Stay organized with collections
Save and categorize content based on your preferences.
Separately reduces each position in array inputs of equal shape, producing an array output of the same shape.
For 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.
Usage | Returns | Reducer.forEachElement() | Reducer |
Argument | Type | Details | this: reducer | Reducer | The reducer to apply to each array element. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["\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. |"]]