ee.Dictionary.evaluate
Asynchronously retrieves the value of this object from the server and passes it to the provided callback function.
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
// 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 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
# The Earth Engine Python client library does not have an evaluate method for
# asynchronous evaluation of ee.Dictionary objects.
# Use ee.Dictionary.getInfo() instead.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["`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 leverages `Dictionary.getInfo()` for synchronous retrieval of dictionary values."]]],["The `evaluate` method asynchronously retrieves a `ComputedObject`'s value from the server and provides it to a callback function. The callback receives a success argument with the result or a failure argument with an error message. It's demonstrated with a dictionary example where server-side data is transferred to the client-side. In Python, `getInfo()` is used instead of `evaluate` for `ee.Dictionary` objects. The provided table details the usage, argument types, and their specifics.\n"]]