I have two feature collections, produced using the reduceRegions function, from different image collections. I can export both as CSV, but I've been trying to join or merge them so I can export them as one single CSV. I just need one column from one feature collection to be added to the other.

I've tried to use the ee.Join.saveAll for this. But it doesn't come out quite right. It joins the feature collections but adds the secondary featureCollection as a single column, so I can't see the data when I export as a CSV. Only one column differs in the second feature collection, and I'd like to add that to the first.

// Use an equals filter to define how the collections match.
var filter = ee.Filter.equals({
  leftField: 'system:index',
  rightField: 'system:index', 

 // Define the join.
 var saveAllJoin = ee.Join.saveAll({
  matchesKey: 'mean',
  ordering: 'system:time_start',
  ascending: true

// Apply the join.
var Dat = saveAllJoin.apply(HS_allVars, allVars, filter);

// Display the result.
print('Dat', Dat);

collection: Dat,
description: 'Dat',
fileFormat: 'CSV'

Here is a link to the full code. The lines I'm having issues with are 918-944. https://code.earthengine.google.com/ae7576ddf2abbc6ee219a7bd4a87b1d2

1 Answer 1


I think you mean that you want the mean attribute of the "joined" feature to be a property of the parent feature, right?

var DatFlat = Dat.map(function(mainFeature){
  var joinedFeaturesList = ee.List(mainFeature.get('mean'))
  return mainFeature.set('mean', ee.Feature(joinedFeaturesList.get(0)).get('mean'));
print('DatFlat', DatFlat)
  • Hi Jonas, that nearly works. I renamed the 'mean' column different so I would that added as a new column, rather than covering the original property. But the mean of the main feature is still masked. The matches key functions seems to insert the data from the second feature into that property/column. I'm not sure how with these two separate feature collections to add the data from one property/column as another property to another. So then I an export as a csv. Updated code is here. code.earthengine.google.com/ded20a78dd2fcd08e4e7ac8014323a06 Jul 6, 2020 at 14:18

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.