I am trying to remove the clouds from my image but when I try to run the masked layer seems to be error. Is there any solution how to remove the clouds or solve the issue.

The link is: https://code.earthengine.google.com/e26a01a49358487dba4c950ba76944ec

This is my code:

l1 = l1.filterDate('1990-10-02', '1990-12-30');
l1 = l1.filterBounds(table);
var sorted = l1.sort('CLOUD_COVER');
var scene = ee.Image(sorted.first());

var visParams = {bands: ['B5','B4', 'B3'], max: 0.3};

var median = l1.filterDate('1990-10-02', '1990-12-30')
Map.addLayer(median, visParams, 'median');
var composite = l1.max();
Map.addLayer(composite, visParams, 'max value composite');
var mosaic = l1.mosaic();
Map.addLayer(mosaic, visParams, 'spatial mosaic');

var cloudMaskL457 = function(image) {
  var qa = image.select('pixel_qa');

  var cloud = qa.bitwiseAnd(1 << 5)
                  .and(qa.bitwiseAnd(1 << 7))
                  .or(qa.bitwiseAnd(1 << 3));

  var mask2 = image.mask().reduce(ee.Reducer.min());
  return image.updateMask(cloud.not()).updateMask(mask2);

var dataset = ee.ImageCollection('LANDSAT/LT05/C01/T1_TOA')
                  .filterDate('1990-10-02', '1990-12-30')

var visParams = {
  bands: ['B5', 'B4', 'B2'],
  min: 0,
  max: 3000,
  gamma: 1.4,

Map.addLayer(dataset.median(), visParams);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.