ee.Geometry.evaluate

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

用法返回
Geometry.evaluate(callback)
参数类型详细信息
this: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.