ee.FeatureCollection.limit

コレクションを特定の数の要素に制限します。必要に応じて、指定されたプロパティで最初に並べ替えます。

制限付きコレクションを返します。

用途戻り値
FeatureCollection.limit(max, property, ascending)コレクション
引数タイプ詳細
これ: collectionコレクションCollection インスタンス。
max数値コレクションを制限する数値。
property文字列、省略可並べ替えを行う場合の並べ替えの基準となるプロパティ。
ascendingブール値、省略可昇順または降順で並べ替えるかどうか。デフォルトは true(昇順)です。

コードエディタ(JavaScript)

// FeatureCollection of global power plants.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants');

print('First 5 features (power plants)', fc.limit(5));

print('Smallest 5 power plants by capacity in ascending order',
      fc.limit({max: 5, property: 'capacitymw'}));

print('Largest 5 power plants by capacity in descending order',
      fc.limit({max: 5, property: 'capacitymw', ascending: false}));

Python の設定

Python API とインタラクティブな開発での geemap の使用については、 Python 環境のページをご覧ください。

import ee
import geemap.core as geemap

Colab(Python)

# FeatureCollection of global power plants.
fc = ee.FeatureCollection('WRI/GPPD/power_plants')

print('First 5 features (power plants):', fc.limit(5).getInfo())

print('Smallest 5 power plants by capacity in ascending order:',
      fc.limit(**{'maximum': 5, 'opt_property': 'capacitymw'}).getInfo())

print('Largest 5 power plants by capacity in descending order:',
      fc.limit(**{'maximum': 5, 'opt_property': 'capacitymw',
                  'opt_ascending': False}).getInfo())