ee.String.getInfo

यह ऑब्जेक्ट की वैल्यू को सर्वर से वापस लाता है.

अगर कोई कॉलबैक फ़ंक्शन नहीं दिया जाता है, तो अनुरोध सिंक्रोनस तरीके से किया जाता है. अगर कॉलबैक दिया जाता है, तो अनुरोध एसिंक्रोनस तरीके से किया जाता है.

एसिंक्रोनस मोड का इस्तेमाल करना बेहतर होता है, क्योंकि सिंक्रोनस मोड में सर्वर से जवाब मिलने तक, अन्य सभी कोड (उदाहरण के लिए, EE Code Editor का यूज़र इंटरफ़ेस) काम करना बंद कर देते हैं. एसिंक्रोनस अनुरोध करने के लिए, getInfo() के बजाय evaluate() का इस्तेमाल करना बेहतर होता है.

इस ऑब्जेक्ट की कैलकुलेट की गई वैल्यू दिखाता है.

इस्तेमालरिटर्न
String.getInfo(callback)ऑब्जेक्ट
आर्ग्यूमेंटटाइपविवरण
यह: computedobjectComputedObjectComputedObject इंस्टेंस.
callbackफ़ंक्शन, ज़रूरी नहीं हैवैकल्पिक कॉलबैक. अगर यह पैरामीटर नहीं दिया जाता है, तो कॉल सिंक्रोनस तरीके से किया जाता है.

उदाहरण

कोड एडिटर (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));  // b
print(ee.String('abc').getInfo()[2]);         // c

// Using + with ee.String has unexpected results
print(ee.String('abc') + 'def');  // ee.String("abc")def

// Fetch string using getInfo
print(ee.String('abc').getInfo() + 'def');  // abcdef

// Improved solution: cat is available on ee.String
print(ee.String('abc').cat('def'));  // abcdef

Python सेटअप करना

Python API और इंटरैक्टिव डेवलपमेंट के लिए geemap का इस्तेमाल करने के बारे में जानकारी पाने के लिए, Python एनवायरमेंट पेज देखें.

import ee
import geemap.core as geemap

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.

print(ee.String('abc').getInfo()[-2])  # b
print(ee.String('abc').getInfo()[2])  # c

# Fetch string using getInfo
print(ee.String('abc').getInfo() + 'def')  # abcdef