หากไม่ได้ระบุฟังก์ชันการเรียกกลับ ระบบจะส่งคำขอแบบพร้อมกัน หากมีการระบุการเรียกกลับ ระบบจะส่งคำขอแบบไม่พร้อมกัน
เราขอแนะนำให้ใช้โหมดอะซิงโครนัสเนื่องจากโหมดซิงโครนัสจะหยุดโค้ดอื่นๆ ทั้งหมด (เช่น UI ของเครื่องมือแก้ไขโค้ด EE) ขณะรอเซิร์ฟเวอร์ หากต้องการส่งคำขอแบบอะซิงโครนัส เราขอแนะนำให้ใช้ evaluate() แทน getInfo()
แสดงผลค่าที่คำนวณแล้วของออบเจ็กต์นี้
การใช้งาน | การคืนสินค้า |
---|---|
Point.getInfo(callback) | วัตถุ |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|---|---|
ดังนี้ computedobject | ComputedObject | อินสแตนซ์ ComputedObject |
callback | ฟังก์ชัน (ไม่บังคับ) | การเรียกกลับที่ไม่บังคับ หากไม่ได้ระบุไว้ ระบบจะโทรแบบพร้อมกัน |
ตัวอย่าง
โปรแกรมแก้ไขโค้ด (JavaScript)
// Define a Point object. var point = ee.Geometry.Point(-122.082, 37.42); // Apply the getInfo method to the Point object. var pointGetInfo = point.getInfo(); // Print the result to the console. print('point.getInfo(...) =', pointGetInfo); // Display relevant geometries on the map. Map.setCenter(-122.085, 37.422, 15); Map.addLayer(point, {'color': 'black'}, 'Geometry [black]: point');
import ee import geemap.core as geemap
Colab (Python)
# Define a Point object. point = ee.Geometry.Point(-122.082, 37.42) # Apply the getInfo method to the Point object. point_get_info = point.getInfo() # Print the result. display('point.getInfo(...) =', point_get_info) # Display relevant geometries on the map. m = geemap.Map() m.set_center(-122.085, 37.422, 15) m.add_layer(point, {'color': 'black'}, 'Geometry [black]: point') m