I am trying to get cloud-free imagery for a specific region during specific dates. I am very new to GEE, but the script below seems to work. However when I look at the imagery that is then printed on the map, all images are black. I've checked and the RGB is correct.
What am I doing wrong?
// A rectangle representing the roi.
var geometry = ee.Geometry.Rectangle(-8.372, 10.017, -2.703, 5.358)
var ic = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA")
.filterBounds(geometry)
.filterDate('2013-01-01','2013-12-01');
var c = ic.filterBounds(geometry);
var withCloudiness = c.map(function(image) {
var cloud = ee.Algorithms.Landsat.simpleCloudScore(image).select('cloud');
var cloudiness = cloud.reduceRegion({
reducer: 'mean',
geometry: geometry,
scale: 30,
maxPixels: 1e9
});
return image.set(cloudiness);
});
var filteredCollection = withCloudiness.filter(ee.Filter.lt('cloud', 10));
// Compute the median in each band, in each pixel.
//var median = filteredCollection.median();
print(filteredCollection);
// Select the red, green and blue bands.
//var filteredCollection = median.select('B3', 'B2', 'B1');
var visParams = {bands: ['B4', 'B3', 'B2'], max:0.4};
Map.addLayer(filteredCollection);
Map.setCenter(-6.01, 6.51, 5);