Stay organized with collections Save and categorize content based on your preferences.
Apply a reducer to each element of a collection, using the given selectors to determine the inputs.

Returns a dictionary of results, keyed with the output names.

FeatureCollection.reduceColumns(reducer, selectors, weightSelectors)Dictionary
this: collectionFeatureCollectionThe collection to aggregate over.
reducerReducerThe reducer to apply.
selectorsListA selector for each input of the reducer.
weightSelectorsList, default: nullA selector for each weighted input of the reducer.


Code Editor (JavaScript)

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

// Calculate mean of a single FeatureCollection property.
var propMean = fc.reduceColumns({
  reducer: ee.Reducer.mean(),
  selectors: ['gwh_estimt']
print('Mean of a single property', propMean);

// Calculate mean of multiple FeatureCollection properties.
var propsMean = fc.reduceColumns({
  reducer: ee.Reducer.mean().repeat(2),
  selectors: ['gwh_estimt', 'capacitymw']
print('Mean of multiple properties', propsMean);

// Calculate weighted mean of a single FeatureCollection property. Add a fuel
// source weight property to the FeatureCollection.
var fuelWeights = ee.Dictionary({
  Wind: 0.9,
  Gas: 0.2,
  Oil: 0.2,
  Coal: 0.1,
  Hydro: 0.7,
  Biomass: 0.5,
  Nuclear: 0.3
fc = {
  return feature.set('weight', fuelWeights.getNumber(feature.get('fuel1')));

var weightedMean = fc.reduceColumns({
  reducer: ee.Reducer.mean(),
  selectors: ['gwh_estimt'],
  weightSelectors: ['weight']
print('Weighted mean of a single property', weightedMean);