I want to modify values in a specific feature collection. This collection comprises two properties: a land cover label and an elevation value. The objective is to replace features with label 13 and an elevation value greater than 800.
With the following feature collection, and applying the S Verhoef approach, I achieve the replacement by using ee.Algorithms.If method.
var feature_list = [
ee.Feature(null, {'UUID':1, 'LABEL': 13, 'ELEVATION': 750}),
ee.Feature(null, {'UUID':2, 'LABEL': 13, 'ELEVATION': 830}),
ee.Feature(null, {'UUID':3, 'LABEL': 1, 'ELEVATION': 30})
];
var fc = ee.FeatureCollection(feature_list);
var conditional = function(feat) {
var islabel = ee.Number(feat.get('LABEL')).eq(13);
var iselev = ee.Number(feat.get('ELEVATION')).gt(800);
var condition = islabel.multiply(iselev);
return ee.Algorithms.If(condition, feat.set({'LABEL': 1}), feat);
};
var test = fc.map(conditional)
Following the GEE Coding best practices, ee.Algorithms.If should be avoided. Are there any other approaches to achieve this feature collection update with the Google Earth Engine API?