0

I have a thesis that I'm writing about Ice coverage change on rivers, and I decided to use Google Earth Engine for this.

I have an algorithm already that can check if the pixel is icy or not. But the problem is I have to mask this to only calculate it on rivers and not anywhere else.

I have a limited knowledge of JavaScript and looked up the API to find a solution for masking. I tried to incorporate the example into my code but it gives me an error "updatemask" is not defined in this scope.

So how do I define this mask? Because at the moment I just create a variable that contains area of a river and assign it to a mask.

var datamask = ShapeFile;      // Uploaded.
var mask     = datamask.eq(1); // As I understand this is where you tell the mask which part to use.
var dif      = updatemask(datamask);
James
  • 679
  • 1
  • 8
  • 22
Bence Kiss
  • 1
  • 1
  • 1

1 Answers1

3

First, the function is named updateMask. Second, it is an instance method for an ee.Image object, which returns another ee.Image object. So you need to set the mask for a particular image. Assuming you may have an image which represents ice, you might do something like

// I am assuming you are loading this via ee.FeatureCollection etc
var datamask = ShapeFile;      
var mask = datamask.eq(1); 

var ice = ee.Image(<some ice asset>);
var masked_ice = ice.updateMask(mask);
Jesse Anderson
  • 4,507
  • 26
  • 36