ee.FeatureCollection.limit

Beschränkt eine Sammlung auf die angegebene Anzahl von Elementen und sortiert sie optional zuerst nach einer angegebenen Eigenschaft.

Gibt die eingeschränkte Sammlung zurück.

NutzungAusgabe
FeatureCollection.limit(max, property, ascending)Sammlung
ArgumentTypDetails
So gehts: collectionSammlungDie Sammlung.
maxZahlDie Anzahl der Elemente, auf die die Sammlung begrenzt werden soll.
propertyString, optionalDie Property, nach der sortiert werden soll, falls eine Sortierung erfolgt.
ascendingBoolesch, optionalGibt an, ob in aufsteigender oder absteigender Reihenfolge sortiert werden soll. Der Standardwert ist „true“ (aufsteigend).

Beispiele

Code-Editor (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}));

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