ee.FeatureCollection.makeArray

Dodaj tablicę 1D do każdej funkcji w kolekcji, łącząc listę właściwości każdej funkcji w tablicę 1D. Wszystkie właściwości muszą mieć wartość liczbową. Jeśli obiekt nie zawiera wszystkich wymienionych właściwości lub któraś z nich nie jest liczbą, zostanie on usunięty z kolekcji wynikowej.

WykorzystanieZwroty
FeatureCollection.makeArray(properties, name)FeatureCollection
ArgumentTypSzczegóły
to: collectionFeatureCollectionKolekcja wejściowa, z której będą wybierane właściwości.
propertiesListaWłaściwości do wybrania.
nameCiąg tekstowy, domyślnie: „array”Nazwa nowej właściwości tablicy.

Przykłady

Edytor kodu (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());

Konfiguracja Pythona

Informacje o interfejsie Python API i używaniu geemap do interaktywnego programowania znajdziesz na stronie Środowisko 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())