ee.Dictionary.evaluate

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

UsageReturns
Dictionary.evaluate(callback)
ArgumentTypeDetails
this: computedobjectComputedObject

The ComputedObject instance.

callbackFunction

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]);
  });
});