如果未提供回调函数,则以同步方式发出请求。如果提供了回调,则会异步发出请求。
建议使用异步模式,因为同步模式在等待服务器时会停止所有其他代码(例如 EE 代码编辑器界面)。如需发出异步请求,建议使用 evaluate() 而不是 getInfo()。
返回此对象的计算值。
用法 | 返回 |
---|---|
LinearRing.getInfo(callback) | 对象 |
参数 | 类型 | 详细信息 |
---|---|---|
此:computedobject | ComputedObject | ComputedObject 实例。 |
callback | 函数(可选) | 可选的回调。如果未提供,则以同步方式进行调用。 |
示例
代码编辑器 (JavaScript)
// Define a LinearRing object. var linearRing = ee.Geometry.LinearRing( [[-122.091, 37.420], [-122.085, 37.422], [-122.080, 37.430]]); // Apply the getInfo method to the LinearRing object. var linearRingGetInfo = linearRing.getInfo(); // Print the result to the console. print('linearRing.getInfo(...) =', linearRingGetInfo); // Display relevant geometries on the map. Map.setCenter(-122.085, 37.422, 15); Map.addLayer(linearRing, {'color': 'black'}, 'Geometry [black]: linearRing');
import ee import geemap.core as geemap
Colab (Python)
# Define a LinearRing object. linearring = ee.Geometry.LinearRing( [[-122.091, 37.420], [-122.085, 37.422], [-122.080, 37.430]] ) # Apply the getInfo method to the LinearRing object. linearring_get_info = linearring.getInfo() # Print the result. display('linearring.getInfo(...) =', linearring_get_info) # Display relevant geometries on the map. m = geemap.Map() m.set_center(-122.085, 37.422, 15) m.add_layer(linearring, {'color': 'black'}, 'Geometry [black]: linearring') m