ee.FeatureCollection.limit

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

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

用途戻り値
FeatureCollection.limit(max, property, ascending)コレクション
引数タイプ詳細
this: 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')

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

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

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