ee.FeatureCollection.makeArray

أضِف مصفوفة أحادية البعد إلى كل عنصر في مجموعة من خلال دمج قائمة بالسمات لكل عنصر في مصفوفة أحادية البعد. يجب أن تكون جميع السمات قيمًا رقمية. إذا لم تتضمّن إحدى الميزات جميع الخصائص المسماة، أو إذا لم يكن أيّ منها رقميًا، سيتم إسقاط الميزة من المجموعة الناتجة.

الاستخدامالمرتجعات
FeatureCollection.makeArray(properties, name)FeatureCollection
الوسيطةالنوعالتفاصيل
هذا: collectionFeatureCollectionمجموعة الإدخال التي سيتم اختيار السمات منها.
propertiesقائمةالسمات المطلوب تحديدها.
nameسلسلة، القيمة التلقائية: "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 للحصول على معلومات حول واجهة برمجة التطبيقات Python واستخدام geemap للتطوير التفاعلي.

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