0

I have classified an image having a class by the name lights. It has value equal to zero. I select the mask by using

var lights_mask = classified_image.eq(0).selfMask(); //binary mask

Now I want to subtract the original image from this raster mask. I have used both methods

var masked_image = image.updateMask(lights_mask);
//or
//var masked_image = image.subtract(lights_mask);

But it returns the original image with masked portion only. I want the mask portion to be removed and the rest of the multi-band image remains the same.

Simple put I want to clip a raster using a raster binary mask

1 Answer 1

1

I think you want .selfMask().mask().

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.