0

I want to display the image with its date as the layer name, but the following code does not work.

var s2 = ee.ImageCollection('COPERNICUS/S2_SR').filterBounds(roi).filterDate(startdate, enddate).first();
var date = s2.date()
Map.addLayer(s2, {}, ' ' + date, true);

1 Answer 1

0
var date = s2.date().format('yyyy-MM-dd').getInfo();

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.