I'm trying to extract values from a FeatureCollection as a list. Here's some example code that I'm using in Earth Engine's code editor:

var viirs = 

var maineCounties = 
    filter(ee.Filter.eq('StateName', 'Maine'));

var maineMeansFeatures = viirs.reduceRegions({
  collection: maineCounties,
  reducer: ee.Reducer.mean(),
  scale: 30

The "maineMeansFeatures" FeatureCollection has a column called "mean" -- I trying to extract the values in "mean" as a list (so, here, it'd be a list of 16 values -- one for each feature).

Any ideas on how to do this? (Note: I'm very new to javascript so I'm not that familiar with FeatureCollections).

1 Answer 1


Take a look at ee.FeatureCollection.aggregate_array:

Aggregates over a given property of the objects in a collection, calculating a list of all the values of the selected property.



should bring you an array of "means".

  • 2
    For those coming to this question (as I was) trying to get the list of unique values of Feature properties within a FeatureCollection, then use the .distinct() method on the FeatureCollection before using the .aggregate_array(): mainMeansFeatures.distinct("mean").aggregate_array("mean"); Note this would make more sense with categorical properties rather than float (in which case they are likely to all be unique!)
    – mikoontz
    Commented May 21, 2021 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.