0

I'm working with Google Earth Engine images and I would like to know if I can mask an Image with a smaller one.

var image = ee.Image("a/big/image")
var mask = ee.Image("a/small/binary/image")

image = image.updateMask(mask)

Will the final image consider the pixel outside of the mask boundaries as masked or unmasked ?

1 Answer 1

0

I tested it with small images and the following code:

var image = ee.Image("COPERNICUS/S2_SR_HARMONIZED/20200105T103421_20200105T103421_T31TFJ")

var visualization = {min: 0, max: 3000, Bands: ['B4', 'B3', 'B2']}

Map.addLayer(image, visualization, 'RGB');

var mask = ee.Image(1).clipToBoundsAndScale(geometry2)
Map.addLayer(mask, {}, "mask")
Map.addLayer(image.updateMask(mask), visualization, "masked")

And the conclusion is that pixels outside of the mask footprint are considered as masked.

see the code in action here: https://code.earthengine.google.com/ecf9cb192b5b4604c8a4b03ce9d44e04

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