ee.FeatureCollection.sort

Trie une collection selon la propriété spécifiée.

Renvoie la collection triée.

UtilisationRenvoie
FeatureCollection.sort(property, ascending)Collection
ArgumentTypeDétails
ceci : collectionCollectionInstance de la collection.
propertyChaînePropriété à utiliser pour le tri.
ascendingBooléen, facultatifIndique si le tri doit être effectué par ordre croissant ou décroissant. La valeur par défaut est "true" (croissant).

Exemples

Éditeur de code (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));

Configuration de Python

Consultez la page Environnement Python pour en savoir plus sur l'API Python et sur l'utilisation de geemap pour le développement interactif.

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