ee.Array.get
Extracts the value at the given position from the input array.
Usage | Returns | Array.get(position) | Number |
Argument | Type | Details | this: array | Array | The array to extract from. |
position | List | The coordinates of the element to get. |
Examples
Code Editor (JavaScript)
print(ee.Array([9]).get([0])); // 9
print(ee.Array([8, 7, 6]).get([2])); // 6
var array = ee.Array([[0, 1, 2], [3, 4, 5]]);
print(array.get([0, 0])); // 0
print(array.get([0, 1])); // 1
print(array.get([1, 0])); // 3
print(array.get([1, 2])); // 5
Python setup
See the
Python Environment page for information on the Python API and using
geemap
for interactive development.
import ee
import geemap.core as geemap
Colab (Python)
display(ee.Array([9]).get([0])) # 9
display(ee.Array([8, 7, 6]).get([2])) # 6
array = ee.Array([[0, 1, 2], [3, 4, 5]])
display(array.get([0, 0])) # 0
display(array.get([0, 1])) # 1
display(array.get([1, 0])) # 3
display(array.get([1, 2])) # 5
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."],[[["`Array.get()` extracts a single value from an array based on its position."],["The `position` argument specifies the index or indices (for multi-dimensional arrays) of the desired element."],["This function returns the value of the element at the specified position within the input array."],["`Array.get()` is applicable to both single and multi-dimensional arrays in Earth Engine."],["This functionality is available in both JavaScript and Python environments within Earth Engine."]]],[]]