I wrote a function to fill in a bitmasked and filtered SLC from Landsat 7. I want multiple inputs because I need to fill in the SLC with different values each time like the median reflectance, the mean reflectance etc. There is a similar question at GEE ImageCollection.map() with multiple-input function and I think I did the exact same thing but it doesn't work.

//Step 3 SLC-filling 

var ReplaceFunction = function(replacement) {
  var Replace = function(Im) {
    var replaced = ee.Im.unmask(replacement)
    return replaced; 
  return Replace

var MedianReflectance = a2_lessthan50.median() //this is just calculating the median reflectance value
var ReplMedian = CollectionMapNoShadow.map(ReplaceFunction(MedianRefl)) //this is the collection that is masked and I want to fill in with the median values 

The error I get is:

cannot read property "unmask" of undefined.

1 Answer 1


I believe my mistake was that I used ee.Im.unmask. Removing the ee. will make it work.

With ee you access server side functions and classes, but the moment you create an object by using that functionality it is already on server side.

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.