[GIS] Convert image boundary to polygon geometry in earth engine

google-earth-engine

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,
palette:
  ['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?

Best Answer

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
  .filterBounds(india)
  // filter date on the similar year as the tree cover (not necesarry)
  .filterDate('2000','2001');

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

Link code

Related Question