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 … Read more 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 – see link to screenshot of printed results.

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

screenshot of printed results

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

Source: JavaSript – Stack Overflow



Leave a Reply

Your email address will not be published. Required fields are marked *