ee.FeatureCollection.makeArray

เพิ่มอาร์เรย์ 1 มิติให้กับฟีเจอร์แต่ละรายการในคอลเล็กชันโดยการรวมรายการพร็อพเพอร์ตี้สำหรับฟีเจอร์แต่ละรายการเป็นอาร์เรย์ 1 มิติ พร็อพเพอร์ตี้ทั้งหมดต้องเป็นค่าตัวเลข หากฟีเจอร์ไม่มีพร็อพเพอร์ตี้ที่มีชื่อทั้งหมด หรือพร็อพเพอร์ตี้ใดๆ ไม่ใช่ตัวเลข ระบบจะทิ้งฟีเจอร์ดังกล่าวจากคอลเล็กชันผลลัพธ์

การใช้งานการคืนสินค้า
FeatureCollection.makeArray(properties, name)FeatureCollection
อาร์กิวเมนต์ประเภทรายละเอียด
ดังนี้ collectionFeatureCollectionการรวบรวมข้อมูลอินพุตที่จะเลือกพร็อพเพอร์ตี้
propertiesรายการพร็อพเพอร์ตี้ที่จะเลือก
nameString, ค่าเริ่มต้น: "array"ชื่อของพร็อพเพอร์ตี้อาร์เรย์ใหม่

ตัวอย่าง

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

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

// A list of feature properties to combine into an array
// (power generation by year).
var properties = ['gwh_2013', 'gwh_2014', 'gwh_2015', 'gwh_2016'];

// Add array of power-generation-by-year property to features.
fc = fc.makeArray(properties, 'gwh_by_year');

print('FeatureCollection with array of selected properties added', fc);
print('See example of new "gwh_by_year" property', fc.first().toDictionary());

การตั้งค่า Python

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

import ee
import geemap.core as geemap

Colab (Python)

from pprint import pprint

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

# A list of feature properties to combine into an array
# (power generation by year).
properties = ['gwh_2013', 'gwh_2014', 'gwh_2015', 'gwh_2016']

# Add array of power-generation-by-year property to features.
fc = fc.makeArray(properties, 'gwh_by_year')

print('FeatureCollection with array of selected properties added:',
      fc.getInfo())
print('See example of new "gwh_by_year" property:')
pprint(fc.first().toDictionary().getInfo())