I am very new at GEE, and I’m trying to classify an image based on the EVI range of various vegetation classes. For example, Bamboo may have a minimum threshold of 0.6712 and maximum of 0.776 EVI. This way I have 10 classes. I obtained the EVI band from my Landsat image.
How do I classify the pixels and assign them values from 1-10 for the 10 classes?
I tried using ee.Algorithms.If
method:
var EVIband = ee.Image(CFL598.select('EVI'));
print("evi", EVIband);
Map.addLayer(EVIband, {min:-0.10, max:0.8, bands:['EVI']}, 'EVI Band');
var ten = ee.Image(ee.Algorithms.If((EVIband.gte(0.6712).and(EVIband.lte(0.776))), EVIband.mask(ee.Number(10))));
print("bamboo", ten);
Map.addLayer(ten);
I was planning to do this for the rest of the 9 classes and use addBands
to create a whole image, but this did not work.