ee.FeatureCollection.limit

הגבלת אוסף למספר האלמנטים שצוין, עם אפשרות למיין אותם קודם לפי מאפיין שצוין.

הפונקציה מחזירה את האוסף המוגבל.

שימושהחזרות
FeatureCollection.limit(max, property, ascending)אוסף
ארגומנטסוגפרטים
זה: collectionאוסףמופע האוסף.
maxמספרהמספר שאליו רוצים להגביל את האוסף.
propertyמחרוזת, אופציונליהמאפיין שלפיו יתבצע המיון, אם המיון מופעל.
ascendingבוליאני, אופציונליהאם למיין בסדר עולה או יורד. ברירת המחדל היא true (סדר עולה).

דוגמאות

עורך הקוד (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

מידע על Python API ועל שימוש ב-geemap לפיתוח אינטראקטיבי מופיע בדף Python Environment.

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