ee.Geometry.evaluate

  • Geometry.evaluate is a method used to asynchronously retrieve the value of a ComputedObject (like a Geometry) from the server.

  • It takes a callback function as an argument, which is executed upon receiving the server response, providing either the evaluated result or an error message.

  • The example demonstrates using Geometry.evaluate with a callback function to print the GeoJSON representation of a computed geometry.

  • While the JavaScript example showcases Geometry.evaluate, the Python library uses Geometry.getInfo() for similar functionality.

Asynchronously retrieves the value of this object from the server and passes it to the provided callback function.

UsageReturns
Geometry.evaluate(callback)
ArgumentTypeDetails
this: computedobjectComputedObjectThe ComputedObject instance.
callbackFunctionA function of the form function(success, failure), called when the server returns an answer. If the request succeeded, the success argument contains the evaluated result. If the request failed, the failure argument will contains an error message.

Examples

Code Editor (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 setup

See the Python Environment page for information on the Python API and using geemap for interactive development.

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.