Earth Engine ha introdotto
livelli di quota non commerciali per salvaguardare le risorse di calcolo condivise e garantire prestazioni affidabili per tutti. I progetti non commerciali utilizzano il livello Community per impostazione predefinita, anche se puoi modificare il livello di un progetto in qualsiasi momento.
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
ee.Dictionary.get
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Estrae un valore denominato da un dizionario. Se il dizionario non contiene la chiave specificata, viene restituito defaultValue, a meno che non sia null.
| Utilizzo | Resi |
|---|
Dictionary.get(key, defaultValue) | Oggetto |
| Argomento | Tipo | Dettagli |
|---|
questo: dictionary | Dizionario | |
key | Stringa | |
defaultValue | Oggetto, valore predefinito: null | |
Esempi
Editor di codice (JavaScript)
// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
var dict = ee.Dictionary({
B1: 182,
B2: 219,
B3: 443
});
print('Value for "B1" key', dict.get('B1'));
// Set a default value for the case where the key does not exist.
print('Value for nonexistent "Band_1" key',
dict.get({key: 'Band_1', defaultValue: -9999}));
Configurazione di Python
Consulta la pagina
Ambiente Python per informazioni sull'API Python e sull'utilizzo di
geemap per lo sviluppo interattivo.
import ee
import geemap.core as geemap
Colab (Python)
# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
dic = ee.Dictionary({
'B1': 182,
'B2': 219,
'B3': 443
})
display('Value for "B1" key:', dic.get('B1'))
# Set a default value for the case where the key does not exist.
display('Value for nonexistent "Band_1" key:',
dic.get(**{'key': 'Band_1', 'defaultValue': -9999}))
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-10-30 UTC.
[null,null,["Ultimo aggiornamento 2025-10-30 UTC."],[],["The `get` method retrieves a value from a dictionary using a specified key. If the key exists, its corresponding value is returned. If the key is absent, a `defaultValue` is returned. The `defaultValue` can be customized, defaulting to `null` if not provided. Usage examples demonstrate retrieving existing values and setting default values for nonexistent keys, in both JavaScript and Python. The `get` method is applicable to dictionary objects.\n"]]