ee.FeatureCollection.sort

Sortuje kolekcję według określonej właściwości.

Zwraca posortowaną kolekcję.

WykorzystanieZwroty
FeatureCollection.sort(property, ascending)Kolekcja
ArgumentTypSzczegóły
to: collectionKolekcjaInstancja kolekcji.
propertyCiąg znakówWłaściwość, według której ma być sortowana lista.
ascendingWartość logiczna, opcjonalnaOkreśla, czy sortować w kolejności rosnącej czy malejącej. Wartość domyślna to true (rosnąco).

Przykłady

Edytor kodu (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));

Konfiguracja Pythona

Informacje o interfejsie Python API i używaniu geemap do interaktywnego programowania znajdziesz na stronie Środowisko 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())