0

I am very new to the Google Earth Engine and found that it is a powerful tool in satellite images processing. I want to separate the land and water part in Sentinel-2 images and work only on the water part.

What should I do to solve this problem?

I am working with the image below:

var image= ee.Image('COPERNICUS/S2_SR/20210619T031541_20210619T032742_T48QYJ');
var visualization = {gain:'0.1,0.1,0.1',scale:5};
Map.addLayer(image,visualization,'1906');
1
  • 1
    Welcome to GIS StackExchange! As a new user, please take the Tour gis.stackexchange.com/tour Simply stating a problem and asking others to solve it is off topic. This is not a tutorial site. Please show what you've tried/where specifically you're stuck.
    – HMSP
    Jul 16, 2021 at 10:42

1 Answer 1

3

Sentinel 2A Data includes a Scene Classification (SCL) which already classifies the images in some very basic classes. Keep in mind, that this classification is in no way perfect, but it should give you a good and quick starting point.

To use it, you would mask the sentinel image by the appropriate value in the SCL. For the values see this page all the way at the bottom.

var image= ee.Image('COPERNICUS/S2_SR/20210619T031541_20210619T032742_T48QYJ');

var mask_land = image.updateMask(image.select('SCL').eq(6))

var visualization = {gain:'0.1,0.1,0.1',scale:5};
Map.addLayer(mask_land,visualization,'1906');

To mask it we first select the Scene Classification band and then build a binary mask, where every pixel that's equal to 6 (which is water) gets a one, and every pixel not equal to 6 gets a 0.

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.