ee.Dictionary.getArray
Extracts a named array value from a dictionary.
Usage | Returns |
---|
Dictionary.getArray(key) | Array |
Argument | Type | Details |
---|
this: dictionary | Dictionary | |
key | String | |
Examples
// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
var dict = ee.Dictionary({
B1: 182,
B2: 219,
B3: 443,
Array: ee.Array([182, 219, 443])
});
print('The "Array" value as an ee.Array object', dict.getArray('Array'));
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
# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
dic = ee.Dictionary({
'B1': 182,
'B2': 219,
'B3': 443,
'Array': ee.Array([182, 219, 443])
})
print('The "Array" value as an ee.Array object:',
dic.getArray('Array').getInfo())
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."],[[["`dictionary.getArray()` extracts a named array value from a given dictionary."],["The function takes the dictionary and the key of the desired array as input."],["It returns the value associated with the specified key as an `ee.Array` object."],["Examples demonstrate usage in both JavaScript and Python within the Earth Engine environment."]]],["The `getArray(key)` method retrieves a named array from a dictionary. It takes a string `key` as an argument, which specifies the name of the array to extract. The method operates on a `dictionary` and returns the corresponding `Array` value. Examples demonstrate extracting the \"Array\" value from a sample dictionary in both JavaScript and Python, showcasing its usage.\n"]]