Announcement: All noncommercial projects registered to use Earth Engine before
April 15, 2025 must
verify noncommercial eligibility to maintain Earth Engine access.
ee.Dictionary.getInfo
Stay organized with collections
Save and categorize content based on your preferences.
Retrieves the value of this object from the server.
If no callback function is provided, the request is made synchronously. If a callback is provided, the request is made asynchronously.
The asynchronous mode is preferred because the synchronous mode stops all other code (for example, the EE Code Editor UI) while waiting for the server. To make an asynchronous request, evaluate() is preferred over getInfo().
Returns the computed value of this object.
Usage | Returns | Dictionary.getInfo(callback) | Object |
Argument | Type | Details | this: computedobject | ComputedObject | The ComputedObject instance. |
callback | Function, optional | An optional callback. If not supplied, the call is made synchronously. |
Examples
Code Editor (JavaScript)
// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
var dict = ee.Dictionary({
B1: 182,
B2: 219,
B3: 443
});
// Request the server-side ee.Dictionary as a client-side object.
print('Client-side object', dict.getInfo());
print('Using the client-side object', Object.keys(dict.getInfo()).length);
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)
# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
dic = ee.Dictionary({
'B1': 182,
'B2': 219,
'B3': 443
})
# Request the server-side ee.Dictionary as a client-side object.
print('Client-side object:', dic.getInfo())
print('Using the client-side object (e.g. fetch number of keys):',
len(dic.getInfo().keys()))
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."],[[["\u003cp\u003eRetrieves the value of a ComputedObject from the Earth Engine server, enabling client-side use.\u003c/p\u003e\n"],["\u003cp\u003eOffers synchronous and asynchronous retrieval modes, with asynchronous being preferred to avoid blocking other code execution.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eevaluate()\u003c/code\u003e is recommended for asynchronous requests, while \u003ccode\u003egetInfo()\u003c/code\u003e can be used with a callback or synchronously.\u003c/p\u003e\n"],["\u003cp\u003eReturns the computed value as a client-side object, allowing interaction with it using standard JavaScript or Python methods.\u003c/p\u003e\n"],["\u003cp\u003eProvides JavaScript and Python code examples to illustrate how to retrieve and utilize the object's value.\u003c/p\u003e\n"]]],["The `getInfo()` method retrieves an object's value from the server. It can operate synchronously, halting other code execution, or asynchronously via a callback function. Asynchronous mode is favored, and the `evaluate()` method is recommended in that case. The method returns the computed object value. Example usage involves requesting a server-side dictionary as a client-side object in both JavaScript and Python. This is illustrated with a dictionary of band values from an image, demonstrating both retrieval and simple usage of the object.\n"],null,["# ee.Dictionary.getInfo\n\n\u003cbr /\u003e\n\nRetrieves the value of this object from the server.\n\n\u003cbr /\u003e\n\nIf no callback function is provided, the request is made synchronously. If a callback is provided, the request is made asynchronously.\n\nThe asynchronous mode is preferred because the synchronous mode stops all other code (for example, the EE Code Editor UI) while waiting for the server. To make an asynchronous request, evaluate() is preferred over getInfo().\n\nReturns the computed value of this object.\n\n| Usage | Returns |\n|------------------------------------|---------|\n| Dictionary.getInfo`(`*callback*`)` | Object |\n\n| Argument | Type | Details |\n|------------------------|--------------------|------------------------------------------------------------------------|\n| this: `computedobject` | ComputedObject | The ComputedObject instance. |\n| `callback` | Function, optional | An optional callback. If not supplied, the call is made synchronously. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).\nvar dict = ee.Dictionary({\n B1: 182,\n B2: 219,\n B3: 443\n});\n\n// Request the server-side ee.Dictionary as a client-side object.\nprint('Client-side object', dict.getInfo());\nprint('Using the client-side object', Object.keys(dict.getInfo()).length);\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).\ndic = ee.Dictionary({\n 'B1': 182,\n 'B2': 219,\n 'B3': 443\n})\n\n# Request the server-side ee.Dictionary as a client-side object.\nprint('Client-side object:', dic.getInfo())\nprint('Using the client-side object (e.g. fetch number of keys):',\n len(dic.getInfo().keys()))\n```"]]