ee.FeatureCollection.limit

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

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

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

דוגמאות

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

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

import ee
import geemap.core as geemap

‫Colab‏ (Python)

# FeatureCollection of global power plants.
fc = ee.FeatureCollection('WRI/GPPD/power_plants')

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

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

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