ee.FeatureCollection.sort

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

แสดงผลคอลเล็กชันที่จัดเรียงแล้ว

การใช้งานการคืนสินค้า
FeatureCollection.sort(property, ascending)คอลเล็กชัน
อาร์กิวเมนต์ประเภทรายละเอียด
ดังนี้ collectionคอลเล็กชันอินสแตนซ์คอลเล็กชัน
propertyสตริงพร็อพเพอร์ตี้ที่จะใช้จัดเรียง
ascendingบูลีน ไม่บังคับเลือกว่าจะจัดเรียงจากน้อยไปมากหรือมากไปน้อย ค่าเริ่มต้นคือ True (จากน้อยไปมาก)

ตัวอย่าง

โปรแกรมแก้ไขโค้ด (JavaScript)

// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
             .filter('country_lg == "Belgium"');

print('Belgium power plants in ascending order by capacity',
      fc.sort('capacitymw'));

print('Belgium power plants in descending order by capacity',
      fc.sort('capacitymw', false));

การตั้งค่า Python

ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า สภาพแวดล้อม Python

import ee
import geemap.core as geemap

Colab (Python)

# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
    'country_lg == "Belgium"')

print('Belgium power plants in ascending order by capacity:',
      fc.sort('capacitymw').getInfo())

print('Belgium power plants in descending order by capacity:',
      fc.sort('capacitymw', False).getInfo())