공지사항:
2025년 4월 15일 전에 Earth Engine 사용을 위해 등록된 모든 비상업용 프로젝트는 Earth Engine 액세스를 유지하기 위해
비상업용 자격 요건을 인증해야 합니다.
ee.List.get
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
목록에서 지정된 위치의 요소를 반환합니다. 음수 색인은 목록의 끝에서부터 역순으로 계산됩니다.
인수 | 유형 | 세부정보 |
---|
다음과 같은 경우: list | 목록 | |
index | 정수 | |
예
코드 편집기 (JavaScript)
// An ee.List object.
var list = ee.List([5, 10, 15, 20, 25, 30]);
// Fetch elements at specified 0-based positions in the list.
print('The second element', list.get(1));
print('The fourth element', list.get(3));
print('The last element', list.get(-1));
print('The second to last element', list.get(-2));
// ee.Number and integer computed objects are valid inputs.
print('Computed object index input', list.get(list.get(0)));
// The result of ee.List.get is an ambiguous object type. You need to cast the
// result to the expected type to use it in subsequent instance methods. For
// example, if you are fetching a number and wish to add it to another number,
// you must cast the .get() result as an ee.Number.
print('Add fetched number to another number', ee.Number(list.get(1)).add(2));
Python 설정
Python API 및 geemap
를 사용한 대화형 개발에 관한 자세한 내용은
Python 환경 페이지를 참고하세요.
import ee
import geemap.core as geemap
Colab (Python)
# An ee.List object.
ee_list = ee.List([5, 10, 15, 20, 25, 30])
# Fetch elements at specified 0-based positions in the list.
print('The second element:', ee_list.get(1).getInfo())
print('The fourth element:', ee_list.get(3).getInfo())
print('The last element:', ee_list.get(-1).getInfo())
print('The second to last element:', ee_list.get(-2).getInfo())
# ee.Number and integer computed objects are valid inputs.
print('Computed object index input:', ee_list.get(list.get(0)).getInfo())
# The result of ee.List.get is an ambiguous object type. You need to cast the
# result to the expected type to use it in subsequent instance methods. For
# example, if you are fetching a number and wish to add it to another number,
# you must cast the .get() result as an ee.Number.
print('Add fetched number to another number:',
ee.Number(list.get(1)).add(2).getInfo())
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003e\u003ccode\u003eList.get()\u003c/code\u003e retrieves an element from an Earth Engine List object at a specified index.\u003c/p\u003e\n"],["\u003cp\u003eNegative index values can be used to access elements from the end of the list, with -1 representing the last element.\u003c/p\u003e\n"],["\u003cp\u003eThe returned element's type is ambiguous and might require explicit casting to a specific Earth Engine type for further operations (e.g., converting to ee.Number to perform calculations).\u003c/p\u003e\n"],["\u003cp\u003eInput indices can be integers, ee.Number objects, or other computed objects that evaluate to an integer.\u003c/p\u003e\n"]]],[],null,["# ee.List.get\n\nReturns the element at the specified position in list. A negative index counts backwards from the end of the list.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-------------------|---------|\n| List.get`(index)` | Object |\n\n| Argument | Type | Details |\n|--------------|---------|---------|\n| this: `list` | List | |\n| `index` | Integer | |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// An ee.List object.\nvar list = ee.List([5, 10, 15, 20, 25, 30]);\n\n// Fetch elements at specified 0-based positions in the list.\nprint('The second element', list.get(1));\nprint('The fourth element', list.get(3));\nprint('The last element', list.get(-1));\nprint('The second to last element', list.get(-2));\n\n// ee.Number and integer computed objects are valid inputs.\nprint('Computed object index input', list.get(list.get(0)));\n\n// The result of ee.List.get is an ambiguous object type. You need to cast the\n// result to the expected type to use it in subsequent instance methods. For\n// example, if you are fetching a number and wish to add it to another number,\n// you must cast the .get() result as an ee.Number.\nprint('Add fetched number to another number', ee.Number(list.get(1)).add(2));\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# An ee.List object.\nee_list = ee.List([5, 10, 15, 20, 25, 30])\n\n# Fetch elements at specified 0-based positions in the list.\nprint('The second element:', ee_list.get(1).getInfo())\nprint('The fourth element:', ee_list.get(3).getInfo())\nprint('The last element:', ee_list.get(-1).getInfo())\nprint('The second to last element:', ee_list.get(-2).getInfo())\n\n# ee.Number and integer computed objects are valid inputs.\nprint('Computed object index input:', ee_list.get(list.get(0)).getInfo())\n\n# The result of ee.List.get is an ambiguous object type. You need to cast the\n# result to the expected type to use it in subsequent instance methods. For\n# example, if you are fetching a number and wish to add it to another number,\n# you must cast the .get() result as an ee.Number.\nprint('Add fetched number to another number:',\n ee.Number(list.get(1)).add(2).getInfo())\n```"]]