This is possible in theory, but not necessarily a good idea. EE is great at working with large amount of pixels but less good at working with complicated features. To do this, you turn your image mask into a FeatureCollection
, using reduceToVectors()
. This works for simple and small images, but will be problematic for more complicated ones, resulting in a large amount of features.
I would suggest that you try to find a different way to attack your use-case, find away where you don't need to turn your image into features.
That said, here's how you could go about if your image was simpler - it will almost certainly not work with yours:
var mask = ee.Image(1)
.clip(ee.Geometry.Point([139.8647, 35.9642]).buffer(10000))
var scale = 1000 // Tweak this
var vectors = mask.reduceToVectors({
geometry: studyArea.geometry(),
scale: scale,
// Will increase the scale of processing to fit within maxPixels.
// You might want to drop this if you need to know the exact scale you've worked with
bestEffort: true,
maxPixels: 1e6 // Tweak this
})
var filtered = studyArea.geometry()
.difference(vectors, scale)
Map.addLayer(vectors, null, 'vectors', false)
Map.addLayer(filtered, null, 'filtered')
https://code.earthengine.google.com/d9f69229ca8f88586f731de8c65d72db