Announcement: All noncommercial projects registered to use Earth Engine beforeApril 15, 2025 mustverify noncommercial eligibility to maintain access. If you have not verified by September 26, 2025, your access may be on hold.

ee.String.getInfo

  • ThegetInfo() method retrieves the value of an object from the server.

  • The request is synchronous if no callback function is provided, and asynchronous if a callback is provided.

  • Asynchronous mode is preferred over synchronous mode for performance reasons.

  • getInfo() returns the computed value of the object.

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.

UsageReturns
String.getInfo(callback)Object
ArgumentTypeDetails
this:computedobjectComputedObjectThe ComputedObject instance.
callbackFunction, optionalAn optional callback. If not supplied, the call is made synchronously.

Examples

Code Editor (JavaScript)

// After getInfo(), the instance is a local JavaScript string.// Regular JavaScript string manipulations are then available.//// Note: getInfo() fetches results from Earth Engine immediately, and may freeze// the browser or lead to poor performance.  Use evaluate() to avoid this.print(ee.String('abc').getInfo().charAt(1));// bprint(ee.String('abc').getInfo()[2]);// c// Using + with ee.String has unexpected resultsprint(ee.String('abc')+'def');// ee.String("abc")def// Fetch string using getInfoprint(ee.String('abc').getInfo()+'def');// abcdef// Improved solution: cat is available on ee.Stringprint(ee.String('abc').cat('def'));// abcdef

Python setup

See the Python Environment page for information on the Python API and usinggeemap for interactive development.

importeeimportgeemap.coreasgeemap

Colab (Python)

# After getInfo(), the instance is a local Python string.# Regular Python string manipulations are then available.# Note: getInfo() fetches results from Earth Engine synchronously;# later expressions will not be evaluated until it completes.display(ee.String('abc').getInfo()[-2])# bdisplay(ee.String('abc').getInfo()[2])# c# Fetch string using getInfodisplay(ee.String('abc').getInfo()+'def')# abcdef

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-10-06 UTC.