ee.FeatureCollection.sort

指定したプロパティでコレクションを並べ替えます。

並べ替えられたコレクションを返します。

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

コードエディタ(JavaScript)

// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
             .filter('country_lg == "Belgium"');

print('Belgium power plants in ascending order by capacity',
      fc.sort('capacitymw'));

print('Belgium power plants in descending order by capacity',
      fc.sort('capacitymw', false));

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('Belgium power plants in ascending order by capacity:',
      fc.sort('capacitymw').getInfo())

print('Belgium power plants in descending order by capacity:',
      fc.sort('capacitymw', False).getInfo())