ee.FeatureCollection.getInfo

ฟังก์ชันที่จำเป็นซึ่งแสดงข้อมูลที่ทราบทั้งหมดเกี่ยวกับคอลเล็กชันนี้ผ่านการเรียก AJAX

แสดงคำอธิบายคอลเล็กชันที่มีช่องต่อไปนี้

  - ฟีเจอร์: รายการที่มีข้อมูลเมตาเกี่ยวกับฟีเจอร์ในคอลเล็กชัน

  - พร็อพเพอร์ตี้: พจนานุกรมที่ไม่บังคับซึ่งมีพร็อพเพอร์ตี้ข้อมูลเมตาของคอลเล็กชัน

การใช้งานการคืนสินค้า
FeatureCollection.getInfo(callback)FeatureCollectionDescription
อาร์กิวเมนต์ประเภทรายละเอียด
ดังนี้ featurecollectionFeatureCollectionอินสแตนซ์ FeatureCollection
callbackฟังก์ชัน (ไม่บังคับ)การเรียกกลับที่ไม่บังคับ หากไม่ได้ระบุไว้ ระบบจะโทรแบบพร้อมกัน หากระบุไว้ ระบบจะเรียกใช้พารามิเตอร์แรกหากสำเร็จ และพารามิเตอร์ที่ 2 หากไม่สำเร็จ

ตัวอย่าง

โปรแกรมแก้ไขโค้ด (JavaScript)

/**
 * WARNING: this function transfers data from Earth Engine servers to the
 * client. Doing so can negatively affect request processing and client
 * performance. Server-side options should be used whenever possible.
 * Learn more about the distinction between server and client:
 * https://developers.google.com/earth-engine/guides/client_server
 */

// A server-side ee.FeatureCollection of power plants in Belgium.
var fcServer = ee.FeatureCollection('WRI/GPPD/power_plants')
             .filter('country_lg == "Belgium"');

// Use getInfo to transfer server-side feature collection to the client. The
// result is an object.
var fcClient = fcServer.getInfo();
print('Client-side feature collection is an object', typeof fcClient);
print('Feature collection object keys', Object.keys(fcClient));
print('Array of features', fcClient.features);
print('Properties of first feature', fcClient.features[0].properties);

การตั้งค่า Python

ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า สภาพแวดล้อม Python

import ee
import geemap.core as geemap

Colab (Python)

"""WARNING: this function transfers data from Earth Engine servers to the
client. Doing so can negatively affect request processing and client
performance. Server-side options should be used whenever possible.
Learn more about the distinction between server and client:
https://developers.google.com/earth-engine/guides/client_server
"""

# A server-side ee.FeatureCollection of power plants in Belgium.
fc_server = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
    'country_lg == "Belgium"')

# Use getInfo to transfer server-side feature collection to the client. The
# result is an object.
fc_client = fc_server.getInfo()
print('Client-side feature collection is a dictionary:', type(fc_client))
print('Feature collection dictionary keys:', fc_client.keys())
print('Array of features:', fc_client['features'])
print('Properties of first feature:', fc_client['features'][0]['properties'])