公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.FeatureCollection.toList
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
以列表形式返回集合的元素。
用法 | 返回 |
---|
FeatureCollection.toList(count, offset) | 列表 |
参数 | 类型 | 详细信息 |
---|
此:collection | FeatureCollection | 要提取的输入集合。 |
count | 整数 | 要提取的最大元素数量。 |
offset | 整数,默认值:0 | 从开头开始要舍弃的元素数量。如果设置了此参数,系统将提取 (offset + count) 个元素,并舍弃前 offset 个元素。 |
示例
代码编辑器 (JavaScript)
// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
.filter('country_lg == "Belgium"');
print('First 5 features to an ee.List', fc.toList(5));
print('Second 5 features to an ee.List', fc.toList(5, 5));
Python 设置
如需了解 Python API 和如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
import ee
import geemap.core as geemap
Colab (Python)
# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
'country_lg == "Belgium"')
print('First 5 features to an ee.List:', fc.toList(5).getInfo())
print('Second 5 features to an ee.List:', fc.toList(5, 5).getInfo())
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003e\u003ccode\u003etoList()\u003c/code\u003e converts an Earth Engine FeatureCollection into an Earth Engine List, enabling easier manipulation and analysis of its features.\u003c/p\u003e\n"],["\u003cp\u003eThis function can optionally limit the number of features fetched using the \u003ccode\u003ecount\u003c/code\u003e parameter and skip initial features using the \u003ccode\u003eoffset\u003c/code\u003e parameter.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003etoList()\u003c/code\u003e retrieves and displays the list of features from an input feature collection, offering flexibility for data extraction within a specific range or subset.\u003c/p\u003e\n"]]],[],null,["# ee.FeatureCollection.toList\n\nReturns the elements of a collection as a list.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------------------------|---------|\n| FeatureCollection.toList`(count, `*offset*`)` | List |\n\n| Argument | Type | Details |\n|--------------------|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `collection` | FeatureCollection | The input collection to fetch. |\n| `count` | Integer | The maximum number of elements to fetch. |\n| `offset` | Integer, default: 0 | The number of elements to discard from the start. If set, (offset + count) elements will be fetched and the first offset elements will be discarded. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// FeatureCollection of power plants in Belgium.\nvar fc = ee.FeatureCollection('WRI/GPPD/power_plants')\n .filter('country_lg == \"Belgium\"');\n\nprint('First 5 features to an ee.List', fc.toList(5));\n\nprint('Second 5 features to an ee.List', fc.toList(5, 5));\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# FeatureCollection of power plants in Belgium.\nfc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(\n 'country_lg == \"Belgium\"')\n\nprint('First 5 features to an ee.List:', fc.toList(5).getInfo())\n\nprint('Second 5 features to an ee.List:', fc.toList(5, 5).getInfo())\n```"]]