Announcement: All noncommercial projects registered to use Earth Engine before
April 15, 2025 must
verify noncommercial eligibility to maintain Earth Engine access.
ee.List.slice
Stay organized with collections
Save and categorize content based on your preferences.
Returns a portion of list between the start index, inclusive, and end index, exclusive. Negative values for start or end count backwards from the end of the list. Values greater than the size of the list are legal but are truncated to the size of list.
Usage | Returns | List.slice(start, end, step) | List |
Argument | Type | Details | this: list | List | |
start | Integer | |
end | Integer, default: null | |
step | Integer, default: null | |
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 2024-06-05 UTC.
[null,null,["Last updated 2024-06-05 UTC."],[[["\u003cp\u003eThis method returns a portion of a list, starting from the \u003ccode\u003estart\u003c/code\u003e index and ending before the \u003ccode\u003eend\u003c/code\u003e index.\u003c/p\u003e\n"],["\u003cp\u003eNegative indices for \u003ccode\u003estart\u003c/code\u003e or \u003ccode\u003eend\u003c/code\u003e are calculated from the end of the list.\u003c/p\u003e\n"],["\u003cp\u003eIf \u003ccode\u003estart\u003c/code\u003e or \u003ccode\u003eend\u003c/code\u003e values exceed the list's size, they are adjusted to the list's boundaries.\u003c/p\u003e\n"],["\u003cp\u003eThe optional \u003ccode\u003estep\u003c/code\u003e argument can be used to select elements at specific intervals, with a default of null implying a step of 1.\u003c/p\u003e\n"]]],["The `List.slice` function extracts a sublist from a given list. It takes `start` and `end` indices (inclusive and exclusive, respectively) and an optional `step`. Negative indices count backward from the end. Out-of-bounds indices are adjusted to the list's boundaries. The function returns a new List. `end` and `step` default to null if not specified.\n"],null,["# ee.List.slice\n\nReturns a portion of list between the start index, inclusive, and end index, exclusive. Negative values for start or end count backwards from the end of the list. Values greater than the size of the list are legal but are truncated to the size of list.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------------------|---------|\n| List.slice`(start, `*end* `, `*step*`)` | List |\n\n| Argument | Type | Details |\n|--------------|------------------------|---------|\n| this: `list` | List | |\n| `start` | Integer | |\n| `end` | Integer, default: null | |\n| `step` | Integer, default: null | |"]]