ee.FeatureCollection.limit

Limita uma coleção ao número especificado de elementos, com a opção de classificar primeiro por uma propriedade especificada.

Retorna a coleção limitada.

UsoRetorna
FeatureCollection.limit(max, property, ascending)Coleção
ArgumentoTipoDetalhes
isso: collectionColeçãoA instância da coleção.
maxNúmeroO número para limitar a coleção.
propertyString, opcionalA propriedade para classificação, se houver.
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 global power plants.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants');

print('First 5 features (power plants)', fc.limit(5));

print('Smallest 5 power plants by capacity in ascending order',
      fc.limit({max: 5, property: 'capacitymw'}));

print('Largest 5 power plants by capacity in descending order',
      fc.limit({max: 5, property: 'capacitymw', ascending: 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 global power plants.
fc = ee.FeatureCollection('WRI/GPPD/power_plants')

print('First 5 features (power plants):', fc.limit(5).getInfo())

print('Smallest 5 power plants by capacity in ascending order:',
      fc.limit(**{'maximum': 5, 'opt_property': 'capacitymw'}).getInfo())

print('Largest 5 power plants by capacity in descending order:',
      fc.limit(**{'maximum': 5, 'opt_property': 'capacitymw',
                  'opt_ascending': False}).getInfo())