Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
Keeping feature collection properties when merging with another feature collection in Google Earth Engine

I'm a relatively new user of Google Earth Engine, although have some experience coding in R. I'm trying to merge several ee.FeatureCollections with identical property labels, as seen in a brief example using trees below.

I've first defined two Feature Collections (random points, just to illustrate the problem), setting two properties for each: a 'type' and a 'status' label with associated values.

var trees = ee.FeatureCollection(ee.Geometry.Point([-122.22599, 37.17605])).set('type','Sycamore').set('status', 'dead');

var trees2 = ee.FeatureCollection(ee.Geometry.Point([-125.3456, 38.16578])).set('type','Aspen').set('status','alive');

I then merge the two Feature Collections: var treesMerge = trees1.merge(trees2);

However, when I print the merged collection, the properties associated with each Feature have not be carried over from the individual Feature Collections:

print(trees1); print(trees2); print(treesMerge);

screenshot of printed results

Is there a way to merge Feature Collections that preserves these properties?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You wrote ee.FeatureCollection(...).set('type','Sycamore').set('status', 'dead'), which does not set properties on the individual features, but properties on the collection as a whole. .merge() doesn't preserve those properties, but it isn't a big deal that it doesn't since copying them would be easy if needed.

If you set properties on the individual features, then .merge() will preserve them.

var trees1 = ee.FeatureCollection([
  ee.Feature(ee.Geometry.Point([-122.22599, 37.17605]))
    .set('type', 'Sycamore')
    .set('status', 'dead')
]);

var trees2 = ee.FeatureCollection([
  // This is equivalent to using .set()
  ee.Feature(
    ee.Geometry.Point([-125.3456, 38.16578]),
    {'type': 'Aspen', 'status': 'alive'}
  )
]);

var treesMerge = trees1.merge(trees2);

print(trees1);
print(trees2);
print(treesMerge);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!