ee.FeatureCollection.toList

以列表形式返回集合的元素。

用法返回
FeatureCollection.toList(count, offset)列表
参数类型详细信息
此:collectionFeatureCollection要提取的输入集合。
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())