ee.Geometry.evaluate

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

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

示例

代码编辑器 (JavaScript)

// Define a callback function that prints a GeoJSON string.
var printGeoJSONString = function(geometry) {
  geometry = ee.Geometry(geometry);
  print(geometry.toGeoJSONString());
};

// Create a simple computed geometry.
var computedGeometry = ee.Geometry.Point(0, 0).buffer(10);

// Evaluate the callback function that asynchronously retrieves and prints
// the GeoJSON string representation of computed geometry.
computedGeometry.evaluate(printGeoJSONString);

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.Geometry objects.
# Use ee.Geometry.getInfo() instead.