ee.FeatureCollection.limit

จำกัดคอลเล็กชันตามจำนวนองค์ประกอบที่ระบุ โดยเลือกจัดเรียงตามพร็อพเพอร์ตี้ที่ระบุก่อนได้

แสดงผลคอลเล็กชันที่จำกัด

การใช้งานการคืนสินค้า
FeatureCollection.limit(max, property, ascending)คอลเล็กชัน
อาร์กิวเมนต์ประเภทรายละเอียด
collectionคอลเล็กชันอินสแตนซ์ 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

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