ee.FeatureCollection.toList

Trả về các phần tử của một tập hợp dưới dạng danh sách.

Cách sử dụngGiá trị trả về
FeatureCollection.toList(count, offset)Danh sách
Đối sốLoạiThông tin chi tiết
this: collectionFeatureCollectionBộ sưu tập đầu vào cần tìm nạp.
countSố nguyênSố lượng phần tử tối đa cần tìm nạp.
offsetSố nguyên, mặc định: 0Số lượng phần tử cần loại bỏ từ đầu. Nếu được đặt, (offset + count) phần tử sẽ được tìm nạp và các phần tử offset đầu tiên sẽ bị loại bỏ.

Ví dụ

Trình soạn thảo mã (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));

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)

# 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())