コールバック関数が指定されていない場合、リクエストは同期的に行われます。コールバックが指定されている場合、リクエストは非同期で行われます。
同期モードではサーバーを待機している間、他のすべてのコード(EE コードエディタの UI など)が停止するため、非同期モードが推奨されます。非同期リクエストを行う場合は、getInfo() よりも evaluate() を使用することをおすすめします。
このオブジェクトの計算値を返します。
用途 | 戻り値 |
---|---|
Dictionary.getInfo(callback) | オブジェクト |
引数 | タイプ | 詳細 |
---|---|---|
これ: computedobject | ComputedObject | ComputedObject インスタンス。 |
callback | 関数(省略可) | オプションのコールバック。指定しない場合、呼び出しは同期的に行われます。 |
例
コードエディタ(JavaScript)
// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image). var dict = ee.Dictionary({ B1: 182, B2: 219, B3: 443 }); // Request the server-side ee.Dictionary as a client-side object. print('Client-side object', dict.getInfo()); print('Using the client-side object', Object.keys(dict.getInfo()).length);
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 }) # Request the server-side ee.Dictionary as a client-side object. print('Client-side object:', dic.getInfo()) print('Using the client-side object (e.g. fetch number of keys):', len(dic.getInfo().keys()))