ee.Geometry.getInfo

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

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

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

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

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

उदाहरण

कोड एडिटर (JavaScript)

// Define a Geometry object.
var geometry = ee.Geometry({
  'type': 'Polygon',
  'coordinates':
    [[[-122.081, 37.417],
      [-122.086, 37.421],
      [-122.084, 37.418],
      [-122.089, 37.416]]]
});

// Apply the getInfo method to the Geometry object.
var geometryGetInfo = geometry.getInfo();

// Print the result to the console.
print('geometry.getInfo(...) =', geometryGetInfo);

// Display relevant geometries on the map.
Map.setCenter(-122.085, 37.422, 15);
Map.addLayer(geometry,
             {'color': 'black'},
             'Geometry [black]: geometry');

Python सेटअप करना

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

import ee
import geemap.core as geemap

Colab (Python)

# Define a Geometry object.
geometry = ee.Geometry({
    'type': 'Polygon',
    'coordinates': [[
        [-122.081, 37.417],
        [-122.086, 37.421],
        [-122.084, 37.418],
        [-122.089, 37.416],
    ]],
})

# Apply the getInfo method to the Geometry object.
geometry_get_info = geometry.getInfo()

# Print the result.
display('geometry.getInfo(...) =', geometry_get_info)

# Display relevant geometries on the map.
m = geemap.Map()
m.set_center(-122.085, 37.422, 15)
m.add_layer(geometry, {'color': 'black'}, 'Geometry [black]: geometry')
m