Add/display all images of mycollection in google earth engine
If you are only displaying a reasonable amount of images you can use a client-side function to add each image as a layer to the map.
Here's an example using 15 images in a polygon you would draw and rename roi
.
var s2 = ee.ImageCollection("COPERNICUS/S2")
.filterBounds(roi)
.select("B2")
.limit(15)
function addImage(image) { // display each image in collection
var id = image.id
var image = ee.Image(image.id)
Map.addLayer(image)
}
s2.evaluate(function(s2) { // use map on client-side
s2.features.map(addImage)
})
In addition to the answer of Kersten, you could also add this piece of code to easily view all the images by moving a slider:
var slider = ui.Slider();
slider.onSlide(function(value) {
var int_value = value * (Map.layers().length() - 1) >> 0;
Map.layers().get(int_value).setOpacity(1);
for (var i = int_value + 1; i < Map.layers().length(); i++) {
Map.layers().get(i).setOpacity(0);
}
});
print(slider);
It does this by changing the opacity of each layer.