ee.FeatureCollection.getInfo
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Một hàm bắt buộc trả về tất cả thông tin đã biết về bộ sưu tập này thông qua lệnh gọi AJAX.
Trả về nội dung mô tả bộ sưu tập có các trường sau:
– features: danh sách chứa siêu dữ liệu về các đối tượng trong bộ sưu tập.
- properties: một từ điển không bắt buộc chứa các thuộc tính siêu dữ liệu của bộ sưu tập.
Cách sử dụng | Giá trị trả về |
---|
FeatureCollection.getInfo(callback) | FeatureCollectionDescription |
Đối số | Loại | Thông tin chi tiết |
---|
this: featurecollection | FeatureCollection | Đối tượng FeatureCollection. |
callback | Hàm, không bắt buộc | Một lệnh gọi lại không bắt buộc. Nếu không được cung cấp, lệnh gọi sẽ được thực hiện đồng bộ. Nếu được cung cấp, sẽ được gọi bằng tham số đầu tiên nếu thành công và tham số thứ hai nếu không thành công. |
Ví dụ
Trình soạn thảo mã (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);
Thiết lập Python
Hãy xem trang
Môi trường Python để biết thông tin về API Python và cách sử dụng geemap
cho quá trình phát triển tương tác.
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'])
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003egetInfo()\u003c/code\u003e retrieves all data from a server-side FeatureCollection to the client as a FeatureCollectionDescription.\u003c/p\u003e\n"],["\u003cp\u003eThe returned FeatureCollectionDescription contains 'features' (metadata about features) and optional 'properties' (collection metadata).\u003c/p\u003e\n"],["\u003cp\u003eThis function can negatively impact performance due to client-side data transfer; server-side alternatives are preferred when feasible.\u003c/p\u003e\n"],["\u003cp\u003eUsage involves calling \u003ccode\u003eFeatureCollection.getInfo()\u003c/code\u003e with an optional callback function for asynchronous execution.\u003c/p\u003e\n"]]],[],null,["# ee.FeatureCollection.getInfo\n\n\u003cbr /\u003e\n\nAn imperative function that returns all the known information about this collection via an AJAX call.\n\n\u003cbr /\u003e\n\nReturns a collection description whose fields include:\n\n- features: a list containing metadata about the features in the collection.\n\n- properties: an optional dictionary containing the collection's metadata properties.\n\n| Usage | Returns |\n|-------------------------------------------|------------------------------|\n| FeatureCollection.getInfo`(`*callback*`)` | FeatureCollectionDescription |\n\n| Argument | Type | Details |\n|---------------------------|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `featurecollection` | FeatureCollection | The FeatureCollection instance. |\n| `callback` | Function, optional | An optional callback. If not supplied, the call is made synchronously. If supplied, will be called with the first parameter if successful and the second if unsuccessful. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n/**\n * WARNING: this function transfers data from Earth Engine servers to the\n * client. Doing so can negatively affect request processing and client\n * performance. Server-side options should be used whenever possible.\n * Learn more about the distinction between server and client:\n * https://developers.google.com/earth-engine/guides/client_server\n */\n\n// A server-side ee.FeatureCollection of power plants in Belgium.\nvar fcServer = ee.FeatureCollection('WRI/GPPD/power_plants')\n .filter('country_lg == \"Belgium\"');\n\n// Use getInfo to transfer server-side feature collection to the client. The\n// result is an object.\nvar fcClient = fcServer.getInfo();\nprint('Client-side feature collection is an object', typeof fcClient);\nprint('Feature collection object keys', Object.keys(fcClient));\nprint('Array of features', fcClient.features);\nprint('Properties of first feature', fcClient.features[0].properties);\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n\"\"\"WARNING: this function transfers data from Earth Engine servers to the\nclient. Doing so can negatively affect request processing and client\nperformance. Server-side options should be used whenever possible.\nLearn more about the distinction between server and client:\nhttps://developers.google.com/earth-engine/guides/client_server\n\"\"\"\n\n# A server-side ee.FeatureCollection of power plants in Belgium.\nfc_server = ee.FeatureCollection('WRI/GPPD/power_plants').filter(\n 'country_lg == \"Belgium\"')\n\n# Use getInfo to transfer server-side feature collection to the client. The\n# result is an object.\nfc_client = fc_server.getInfo()\nprint('Client-side feature collection is a dictionary:', type(fc_client))\nprint('Feature collection dictionary keys:', fc_client.keys())\nprint('Array of features:', fc_client['features'])\nprint('Properties of first feature:', fc_client['features'][0]['properties'])\n```"]]