I have imported Hansen image for global forest change and clipped it for a specific region(India). Then using the code below I extracted the areas where tree cover is greater then 25%.

var treeCanopyCover = hansen.clip(india).select('treecover2000');
var greater25 = treeCanopyCover.gte(25);
var treeCover_greater25 = treeCanopyCover.updateMask(greater25);

var treeCanopyCoverVis = {
  min: 25.0,
 max: 100.0,
  ['3d3d3d', '080a02', '080a02', '080a02', '106e12', '37a930', '03ff17'],


Map.setCenter(82.5, 23.5);
 Map.addLayer(treeCover_greater25, treeCanopyCoverVis, 'Tree Canopy Cover');

Since the output is an image I can't appply 'filterBounds' to filter an image Collection over this area.Is there any way that I can convert this to polygon geometry so that I can filter my image collection over these forest areas?


You can try using reduceToVectors, but for a large area as India that would possibly run out of computation. I think it is better if you apply the geometry of India to filter the image collection on. You can then use updateMask to masked out all the pixels that are not forest in 2000 based on the Hansen dataset:

 // get landsat 5 images (as an example, could be any image collection)
 var landsat5 = ee.ImageCollection("LANDSAT/LT05/C01/T1_TOA")
  // filter bounds on the geometry of India
  // filter date on the similar year as the tree cover (not necesarry)

// Mask out all the pixels that are tree cover
var maskedLandsat5 = landsat5.map(function(image){
  return image.updateMask(greater25);

Link code

  • But I also need to print a chart showing monthly mean NDVI variation in forest regions of India. So, what will I specify as the 'region' while printing chart if I can't get the forest regions as 'geometry'. Will the result be accurate if I give 'region' as whole 'India'? – Reema Mathew Jul 2 '19 at 4:16
  • Yes give as region the whole of India in that chart. All pixels that are masked won't be displayed in the chart – Kuik Jul 2 '19 at 8:29
  • Thank you so much! – Reema Mathew Jul 2 '19 at 10:14

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.