0

This is my collection with (453 elements) in it which I firstly added filterBounds(polygon):

var collection = collection_L5.merge(collection_L7).merge(collection_S2);
print(collection)

But many images have less than 20% or 50% coverage with my polygon. I also used ee.Filter.contains('.geo', polygon) to filter it but it returns 20 images and I know there are many more than this.

So I want to filter those that has coverage with my polygon less than 80%. How can I do that?

1 Answer 1

1

filterBounds returns true if any portion intersects the ROI. contains returns true only if all portions intersect the ROI.

You get partial overlap percentage, compute the area of intersection and divide it by the total area of the image geometry.

var tol = 1000  // tolerance, in meters.
var results = collection.map(function(img) { 
   var overlap = img.geometry().intersection(ROI, tol)
   var ratio = overlap.area(tol).divide(img.geometry().area(tol))
   return img.set("coverage", ratio)
}).filter("coverage > 0.8")

(but IMO that's overkill. It's easier to just negative buffer the ROI by 80% of the size of an image and use filterBounds).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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