0

This question already has an answer here:

I'm currently producing Timelapses with Google Earth Engine. I have produced the video but I haven't found a way of adding the Date (or the Year of the picture) to the different images that are being reproduced in the video.

Here is my script:

//Composite true colors with correction filled
var L5 = ee.ImageCollection('LANDSAT/LT05/C01/T1_SR')
.filter(ee.Filter.lt('CLOUD_COVER',25))
.select(['B3', 'B2', 'B1'])
.filterBounds(Uyuni);

var L7 = ee.ImageCollection("LANDSAT/LE07/C01/T1_SR")
          .filter(ee.Filter.lt('CLOUD_COVER',25))
          .select(['B3', 'B2', 'B1'])
          .filterBounds(Uyuni)
          .map(function(image){
          var filled1a = image.focal_mean(1, 'square', 'pixels', 2);
          return filled1a.blend(image);
});

// Landat 8 surface reflection data, rename the band names. See USGS pages for more info
var L8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filter(ee.Filter.lt('CLOUD_COVER',25))
.filterBounds(Uyuni)
.map(function(image){
  return image.rename(['B0', 'B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9', 'B10', 'B11']);
})
.select(['B3', 'B2', 'B1']);

// merge L5, L7 & L8
var collection_merge = ee.ImageCollection(L5.merge(L7.merge(L8)));
print (collection_merge);

//building a collection containing one image per year ( create a list of years to be iterated over next..)
var years = ee.List.sequence(2009, 2019);
print (years);

//create a collection with 1 image for each year
var collectYear = ee.ImageCollection(years
  .map(function(y) {
    var start = ee.Date.fromYMD(y, 1, 1);
    var end = start.advance(12, 'month');
    return collection_merge.filterDate(start, end).reduce(ee.Reducer.median());
}));
print (collectYear);

// count number of bands in each image, if 0 remove from image collection
var nullimages = collectYear
    .map(function(image) {
      return image.set('count', image.bandNames().length());
    })
    .filter(ee.Filter.eq('count', 3));
print(nullimages);

// visualise the collection
var finalCollection = nullimages.map(function(image){
  return image.visualize({bands: ['B3_median', 'B2_median', 'B1_median'], 
  min: 0,
  max: 8000,
  });

});


// Export the collection to video based on the geometry region
Export.video.toDrive({
  collection: finalCollection,
  description: 'yearly',
  dimensions: 1080,
  framesPerSecond: 1,
  region: Uyuni
});


// add to map the first image in collection to check
var median_1987 = finalCollection.first();
Map.addLayer(median_1987, {bands: ['vis-red', 'vis-green', 'vis-blue']}, 'first image7');



marked as duplicate by Jochen Schwarze, TomazicM, Community Jul 26 at 6:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.