1

I am trying to mask out a section of an image I created with an algorithm. I create a geometry of the section I want to mask out and clipped that with an image of 1's to create my mask image. But when I attempt to mask my original image it only clips the part I'm trying to remove rather than masking out the section and retaining the rest.

how can I remove the pixels from my mask and retain the rest of the image?

link: https://code.earthengine.google.com/844c40e72f98761c0bbe46a003989213

1 Answer 1

2

If I understand correctly, this is what you need:

var basemap = ee.ImageCollection([image5, image3]).max()
var buff = seam.buffer(14000)
var mask = ee.Image.constant(1).clip(buff).mask().not()
var newBasemap = basemap.updateMask(mask)
Map.addLayer(newBasemap, {}, 'newBasemap')

I also made a public function for that

var tools = require('users/fitoprincipe/geetools:tools')
var basemap = ee.ImageCollection([image5, image3]).max()
var buff = seam.buffer(14000)
var newBasemap = tools.geometry.maskInside(basemap, buff)
Map.addLayer(newBasemap, {}, 'newBasemap')

link: https://code.earthengine.google.com/c08efa296c63ecbbe2107cf6e0129329

0

Your Answer

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

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