I simply want to join the two collections in the way, that the joined feature collection has all properties of the primary and secondary feature collections.
// Create the primary collection.
var primaryFeatures = ee.FeatureCollection([
ee.Feature(null, {foo: 0, ID: 'a'}),
ee.Feature(null, {foo: 1, ID: 'b'}),
ee.Feature(null, {foo: 1, ID: 'c'}),
ee.Feature(null, {foo: 2, ID: 'd'}),
]);
// Create the secondary collection.
var secondaryFeatures = ee.FeatureCollection([
ee.Feature(null, {bar: 1, ID: 'a'}),
ee.Feature(null, {bar: 1, ID: 'b'}),
ee.Feature(null, {bar: 2, ID: 'c'}),
ee.Feature(null, {bar: 3, ID: 'd'}),
]);
// Use an equals filter to specify how the collections match.
var toyFilter = ee.Filter.equals({
leftField: 'ID',
rightField: 'ID'
});
// Define the join.
var innerJoin = ee.Join.simple()
// Apply the join.
var toyJoin = innerJoin.apply(primaryFeatures, secondaryFeatures, toyFilter);
// Print the result.
print('Inner join toy example:', toyJoin);
The final toyJoin feature collection should have 5 Feature with the 3 properties ID, foo and bar. Thank you very much!