ee.FeatureCollection.aggregate_sum

รวบรวมพร็อพเพอร์ตี้ที่กำหนดของออบเจ็กต์ในคอลเล็กชัน โดยคำนวณผลรวมของค่าของพร็อพเพอร์ตี้ที่เลือก

การใช้งานการคืนสินค้า
FeatureCollection.aggregate_sum(property)ตัวเลข
อาร์กิวเมนต์ประเภทรายละเอียด
ดังนี้ collectionFeatureCollectionคอลเล็กชันที่จะรวบรวมข้อมูล
propertyสตริงพร็อพเพอร์ตี้ที่จะใช้จากแต่ละองค์ประกอบของคอลเล็กชัน

ตัวอย่าง

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

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

print('Sum of power plant capacities (MW)',
      fc.aggregate_sum('capacitymw'));  // 13288.600000000002

การตั้งค่า 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('Sum of power plant capacities (MW):',
      fc.aggregate_sum('capacitymw').getInfo())  # 13288.600000000002