我只是想加入这两个集合的方式,加入的特征集合具有主要和次要特征集合的所有属性。
// 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);
最终的 toyJoin 特征集合应该有 5 个特征,具有 3 个属性 ID、foo 和 bar。非常感谢!