ee.Number.getInfo
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Pobiera wartość tego obiektu z serwera.
Jeśli nie podasz funkcji wywołania zwrotnego, żądanie zostanie przesłane synchronicznie. Jeśli podano numer telefonu do oddzwonienia, żądanie jest wysyłane asynchronicznie.
Tryb asynchroniczny jest preferowany, ponieważ tryb synchroniczny zatrzymuje cały inny kod (np. interfejs EE Code Editor) podczas oczekiwania na serwer. Aby wysłać żądanie asynchroniczne, użyj funkcji evaluate() zamiast getInfo().
Zwraca obliczoną wartość tego obiektu.
Wykorzystanie | Zwroty |
---|
Number.getInfo(callback) | Obiekt |
Argument | Typ | Szczegóły |
---|
to: computedobject | ComputedObject | Obiekt ComputedObject. |
callback | Funkcja (opcjonalnie) | opcjonalne wywołanie zwrotne. Jeśli nie zostanie podany, wywołanie zostanie wykonane synchronicznie. |
Przykłady
Edytor kodu (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
Konfiguracja Pythona
Informacje o interfejsie Python API i o używaniu pakietu geemap
do programowania interaktywnego znajdziesz na stronie
Python Environment.
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
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-25 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-25 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```"]]