AI-generated Key Takeaways
-
Dictionary.evaluate()
asynchronously retrieves the value of a server-side ComputedObject (like a dictionary) and passes it to a callback function. -
The provided callback function handles the server response, receiving the evaluated result on success or an error message on failure.
-
Dictionary.evaluate()
enables client-side access and manipulation of the server-side dictionary data using standard JavaScript operations. -
While the JavaScript API uses
Dictionary.evaluate()
, the Python API leveragesDictionary.getInfo()
for synchronous retrieval of dictionary values.
Usage | Returns |
---|---|
Dictionary.evaluate(callback) |
Argument | Type | Details |
---|---|---|
this: computedobject | ComputedObject | The ComputedObject instance. |
callback | Function | A 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)
// 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]); }); });
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.