4

I want to threshold the treecover2000 layer (i.e., tree cover in year 2000) at 25% using GEE. How would I do that? Below is code I wrote to load the gfc tree cover dataset

var gfcImage = ee.Image('UMD/hansen/global_forest_change_2015');
var treeCover = gfcImage.select(['treecover2000']);

Do I have to do something like below?

var treeCover25=gfcImage.select(['treecover2000']).select(0.25);
4

You can mask out values less than 25% like this:

var gfcImage = ee.Image('UMD/hansen/global_forest_change_2015');
var treeCover = gfcImage.select(['treecover2000']);
var greater25 = treeCover.gte(25)  // this is a mask

var treeCover_greater25 = treeCover.updateMask(greater25)

Map.addLayer(treeCover_greater25)  // Watch if it is what you need

link: https://code.earthengine.google.com/ae2f5792e1b9df272385d718dd14d6bb

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.