公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.FeatureCollection.getInfo
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
一种命令式函数,可通过 AJAX 调用返回有关此集合的所有已知信息。
返回字段包括以下内容的集合说明:
- features:一个列表,包含有关集合中特征的元数据。
- properties:一个可选的字典,包含集合的元数据属性。
用法 | 返回 |
---|
FeatureCollection.getInfo(callback) | FeatureCollectionDescription |
参数 | 类型 | 详细信息 |
---|
此:featurecollection | FeatureCollection | FeatureCollection 实例。 |
callback | 函数(可选) | 可选的回调。如果未提供,则以同步方式进行调用。如果提供,则在成功时使用第一个参数调用,在不成功时使用第二个参数调用。 |
示例
代码编辑器 (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'])
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\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```"]]