From Tree Canopy height and Tree Canopy Cover
use the code below or follow this link
// import tree canopy cover and tree canopy height var tccCollection = ee.ImageCollection("projects/servir-mekong/UMD/tree_canopy"); var tchCollection = ee.ImageCollection("projects/servir-mekong/UMD/tree_height"); // combine the data var combine = function(img){ var image = img.rename("tcc"); var t = ee.Date(img.get('system:time_start')); var tch = ee.Image(tchCollection.filterDate(t,t.advance(100,"day")).first()).rename("tch"); return image.addBands(tch).set("system:time_start",t); }; // combine the two datasets var tccTch = tccCollection.map(combine); // set the thresholds var thtcc = 10; var thtch = 5; // get the tcc and tch and set the thresholds var forestMap = function(img){ var t = ee.Date(img.get('system:time_start')); var tcc = img.select("tcc").gte(thtcc); var tch = img.select("tch").gte(thtch); var forest = tcc.and(tch); return forest.set("system:time_start",t); } // create the forest map var forestCollection = tccTch.map(forestMap) // create an empty map for the first year var first = ee.List([ ee.Image(0).set('system:time_start', time0).select([0], ['tcc'])]); // get the time of img 1 var time0 = forestCollection.first().get('system:time_start'); // function to iterate from 1987 to now var accumulate = function(image, list) { var previous = ee.Image(ee.List(list).get(-1)); var added = image.add(previous); var result = added.where(image.eq(0),0).set('system:time_start', image.get('system:time_start')); return ee.List(list).add(result); }; // we use iterate here as the calculate all in sequence var tsdIterate = ee.ImageCollection(ee.List(forestCollection.iterate(accumulate, first))); // get the 2018 image var myImg = ee.Image(tsdIterate.toList(500).get(31)) // display the image Map.addLayer(myImg,{min:0,max:31,palette:"red,orange,yellow,green,darkgreen"})
where can we attain global Tree Canopy height and Tree Canopy Cover data ,because i see that the data used in your code is not global data,but i want use this data in other region, i hope that you can give me an intruduction,thank you.
check this repository: ee.Image(“UMD/hansen/global_forest_change_2020_v1_8”)