ee.Dictionary.evaluate

以异步方式从服务器检索此对象的值,并将其传递给所提供的回调函数。

用法返回
Dictionary.evaluate(callback)
参数类型详细信息
此:computedobjectComputedObjectComputedObject 实例。
callback函数一种函数,形式为 function(success, failure),在服务器返回答案时调用。如果请求成功,success 实参将包含评估结果。如果请求失败,失败实参将包含错误消息。

示例

代码编辑器 (JavaScript)

// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
var dictServer = ee.Dictionary({
  B1: 182,
  B2: 219,
  B3: 443
});

// Use evaluate to transfer server-side dictionary to the client.
dictServer.evaluate(function(dictClient) {
  print('Client-side dot notation to access "B1" value', dictClient.B1);
  print('Client-side bracket notation to access "B1" value', dictClient['B1']);

  print('Client-side operations to print all key-value pairs');
  Object.keys(dictClient).forEach(function(key) {
    print('    ' + key + ': ' + dictClient[key]);
  });
});

Python 设置

如需了解 Python API 和如何使用 geemap 进行交互式开发,请参阅 Python 环境页面。

import ee
import geemap.core as geemap

Colab (Python)

# The Earth Engine Python client library does not have an evaluate method for
# asynchronous evaluation of ee.Dictionary objects.
# Use ee.Dictionary.getInfo() instead.