Announcement: All noncommercial projects registered to use Earth Engine before
April 15, 2025 must
verify noncommercial eligibility to maintain Earth Engine access.
ee.Number.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 | Number.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)
/**
* WARNING: this function transfers data from Earth Engine servers to the
* client. Doing so can negatively affect request processing and client
* performance. Server-side options should be used whenever possible.
* Learn more about the distinction between server and client:
* https://developers.google.com/earth-engine/guides/client_server
*/
// A server-side ee.Number object.
var numberServer = ee.Number(10.3);
// Use evaluate to transfer server-side number to the client.
var numberClient = numberServer.getInfo();
print('Client-side primitive data type', typeof numberClient); // number
print('Client-side number', numberClient); // 10.3
print('Client-side number used in expression', numberClient + 10); // 20.3
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)
"""WARNING: this function transfers data from Earth Engine servers to the
client. Doing so can negatively affect request processing and client
performance. Server-side options should be used whenever possible.
Learn more about the distinction between server and client:
https://developers.google.com/earth-engine/guides/client_server
"""
# A server-side ee.Number object.
number_server = ee.Number(10.3)
number_client = number_server.getInfo()
print('Client-side primitive data type:', type(number_client)) # float
print('Client-side number:', number_client) # 10.3
print('Client-side number used in expression:', number_client + 10) # 20.3
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 computed value of an object from the Earth Engine server, transferring it to the client.\u003c/p\u003e\n"],["\u003cp\u003eOffers synchronous and asynchronous modes, with the asynchronous mode (using \u003ccode\u003eevaluate()\u003c/code\u003e) being preferred for better performance.\u003c/p\u003e\n"],["\u003cp\u003eSynchronous requests using \u003ccode\u003egetInfo()\u003c/code\u003e can block other code execution while waiting for the server response.\u003c/p\u003e\n"],["\u003cp\u003eIt's important to be mindful of the potential performance impact of transferring server-side data to the client.\u003c/p\u003e\n"]]],[],null,["# ee.Number.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| Number.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/**\n * WARNING: this function transfers data from Earth Engine servers to the\n * client. Doing so can negatively affect request processing and client\n * performance. Server-side options should be used whenever possible.\n * Learn more about the distinction between server and client:\n * https://developers.google.com/earth-engine/guides/client_server\n */\n\n// A server-side ee.Number object.\nvar numberServer = ee.Number(10.3);\n\n// Use evaluate to transfer server-side number to the client.\nvar numberClient = numberServer.getInfo();\nprint('Client-side primitive data type', typeof numberClient); // number\nprint('Client-side number', numberClient); // 10.3\nprint('Client-side number used in expression', numberClient + 10); // 20.3\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\"\"\"WARNING: this function transfers data from Earth Engine servers to the\nclient. Doing so can negatively affect request processing and client\nperformance. Server-side options should be used whenever possible.\nLearn more about the distinction between server and client:\nhttps://developers.google.com/earth-engine/guides/client_server\n\"\"\"\n\n# A server-side ee.Number object.\nnumber_server = ee.Number(10.3)\n\nnumber_client = number_server.getInfo()\nprint('Client-side primitive data type:', type(number_client)) # float\nprint('Client-side number:', number_client) # 10.3\nprint('Client-side number used in expression:', number_client + 10) # 20.3\n```"]]