ee.FeatureCollection.limit

Membatasi kumpulan ke jumlah elemen yang ditentukan, dengan opsi untuk mengurutkannya terlebih dahulu berdasarkan properti yang ditentukan.

Menampilkan koleksi terbatas.

PenggunaanHasil
FeatureCollection.limit(max, property, ascending)Koleksi
ArgumenJenisDetail
ini: collectionKoleksiInstance Koleksi.
maxAngkaJumlah untuk membatasi koleksi.
propertyString, opsionalProperti yang akan diurutkan, jika pengurutan.
ascendingBoolean, opsionalApakah akan mengurutkan dalam urutan menaik atau menurun. Defaultnya adalah benar (menaik).

Contoh

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}));

Penyiapan Python

Lihat halaman Lingkungan Python untuk mengetahui informasi tentang Python API dan penggunaan geemap untuk pengembangan interaktif.

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