ee.ImageCollection.limit
Limit a collection to the specified number of elements, optionally sorting them by a specified property first.
Returns the limited collection.
Usage | Returns |
---|
ImageCollection.limit(max, property, ascending) | Collection |
Argument | Type | Details |
---|
this: collection | Collection | The Collection instance. |
max | Number | The number to limit the collection to. |
property | String, optional | The property to sort by, if sorting. |
ascending | Boolean, optional | Whether to sort in ascending or descending order. The default is true (ascending). |
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."],[[["Limits the number of elements within a collection to a specified maximum."],["Optionally sorts the collection by a given property before limiting the results, in either ascending or descending order."],["Returns the modified collection with the applied limit and optional sorting."]]],["The `limit` method restricts a collection to a specified number of elements (`max`). It optionally sorts the collection beforehand by a given `property`. Sorting can be in ascending (default) or descending order, controlled by the `ascending` argument. The method operates on a `Collection` instance and returns the modified, limited `Collection`. The method requires a number for max and accepts an optional String for the property to sort by and an optional boolean for the sort direction.\n"]]