ee.FeatureCollection.sort

Sortiert eine Sammlung nach dem angegebenen Attribut.

Gibt die sortierte Sammlung zurück.

NutzungAusgabe
FeatureCollection.sort(property, ascending)Sammlung
ArgumentTypDetails
So gehts: collectionSammlungDie Sammlung.
propertyStringDas Attribut, nach dem sortiert werden soll.
ascendingBoolesch, optionalGibt an, ob in aufsteigender oder absteigender Reihenfolge sortiert werden soll. Der Standardwert ist „true“ (aufsteigend).

Beispiele

Code-Editor (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 einrichten

Informationen zur Python API und zur Verwendung von geemap für die interaktive Entwicklung finden Sie auf der Seite Python-Umgebung.

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