ee.Dictionary.getGeometry
Extracts a named geometry value from a dictionary.
Usage | Returns |
---|
Dictionary.getGeometry(key) | Geometry |
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,
Geometry: ee.Geometry.Point([-122.01, 36.97])
});
print('The "Geometry" value as an ee.Geometry object',
dict.getGeometry('Geometry'));
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,
'Geometry': ee.Geometry.Point([-122.01, 36.97])
})
print('The "Geometry" value as an ee.Geometry object',
dic.getGeometry('Geometry').getInfo(), sep='\n')
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.getGeometry()` extracts a named geometry value (as an ee.Geometry object) from an input dictionary using a specified key."],["The method requires a dictionary object and a string key as input."],["Examples in JavaScript, Python, and Colab demonstrate how to use `Dictionary.getGeometry()` to retrieve geometry information from dictionaries."]]],["The `getGeometry(key)` method retrieves a geometry object from a dictionary using a specified key. The method requires a dictionary and a string key as input. It returns a `Geometry` object, if the key `\"Geometry\"` exist, otherwise it may return `null`. Examples demonstrate retrieving the geometry using both JavaScript and Python, showcasing how to extract the geometry value associated with the `\"Geometry\"` key from a dictionary.\n"]]