ee.FeatureCollection.makeArray

各フィーチャのプロパティのリストを 1 次元配列に結合して、コレクション内の各フィーチャに 1 次元配列を追加します。すべてのプロパティは数値である必要があります。名前付きプロパティがすべて含まれていない場合、または名前付きプロパティのいずれかが数値でない場合、その特徴は結果のコレクションから削除されます。

用途戻り値
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 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())