ee.ImageCollection.iterate
Applies 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.
Returns the result of the Collection.iterate() call.
Usage | Returns |
---|
ImageCollection.iterate(algorithm, first) | ComputedObject |
Argument | Type | Details |
---|
this: collection | Collection | The Collection instance. |
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. |
first | Object, optional | The initial state. |
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."],[[["Applies a custom function iteratively to each element of a collection, using the previous result in each subsequent calculation."],["Returns the final computed value after applying the function across all elements."],["Begins with an initial state (optional) and updates it based on the user-provided function and each element in the collection."],["Useful for implementing custom algorithms or calculations across collections like ImageCollections."]]],["`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"]]