I'm using a code wrote here in Stack in the question Mosaicking a Image Collection by Date (day) in Google Earth Engine to generate mosaics of Sentinel-1 by date (day) with images that cover a region. But in the code, the new Image Collection don't have a ID for each mosaic, anything like the date of the images or the date of images interval that it uses. There is any way to do this?
My code is:
var start = ee.Date('2014-10-01');
var finish = ee.Date('2018-03-31');
var collection = ee.ImageCollection('COPERNICUS/S1_GRD')
.filterDate(start, finish)
.filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))
.filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VH'))
.filter(ee.Filter.eq('instrumentMode', 'IW'))
.filterMetadata('resolution_meters', 'equals', 10)
.filterBounds(poly);
print(collection,"Original collection");
// Difference in days between start and finish
var diff = finish.difference(start, 'day');
print(diff, "Diferenca em dias");
// Make a list of all dates
var range = ee.List.sequence(0, diff.subtract(1)).map(function(day){return start.advance(day,'day')});
print(range, "Lista de todas as datas");
// Funtion for iteraton over the range of dates
var day_mosaics = function(date, newlist) {
// Cast
date = ee.Date(date);
newlist = ee.List(newlist);
// Filter collection between date and the next day
var filtered = collection.filterDate(date, date.advance(1,'day'));
// get date as YEARMONTHDAY. For example, for January 8th 2010
// would be: 20100108
var date_formatted = ee.Number.parse(date.format('YYYYMMdd'))
// make date band as an 32 bit unsigned integer and rename it as 'date'
var dateband = ee.Image.constant(date_formatted).toUint32().rename('date');
// Make the mosaic
var image = ee.Image(filtered.mosaic());
// Add the mosaic to a list only if the collection has images
return ee.List(ee.Algorithms.If(filtered.size(), newlist.add(image), newlist));
};
// Iterate over the range to make a new list, and then cast the list to an imagecollection
var newcol = ee.ImageCollection(ee.List(range.iterate(day_mosaics, ee.List([]))));
print(newcol, "Collection with mosaic images");
Map.centerObject(poly);
Map.addLayer(newcol, {bands: 'VV', min: -20, max: -5});
Follow the link to my code: Mosaicking by date.