ee.FeatureCollection.sort

Classifica uma coleção pela propriedade especificada.

Retorna a coleção classificada.

UsoRetorna
FeatureCollection.sort(property, ascending)Coleção
ArgumentoTipoDetalhes
isso: collectionColeçãoA instância da coleção.
propertyStringA propriedade para classificação.
ascendingBooleano, opcionalIndica se a classificação será em ordem crescente ou decrescente. O padrão é "true" (crescente).

Exemplos

Editor de código (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));

Configuração do Python

Consulte a página Ambiente Python para informações sobre a API Python e como usar geemap para desenvolvimento interativo.

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