I need extract date of each image and set to the id in each date by the below code. Although all elements in modis collection included 'system:time_start'
property, code returns error. Does anyone has any idea?
Code link: https://code.earthengine.google.com/a197f55e46e62099a53a9d47dc171f7e
Map.centerObject(geometry);
var modisData = function(img){
var bands = img.select('su.*').multiply(0.0001);
var date = ee.String(bands.date().format('YYYY-MM-dd'));
return bands
.copyProperties(img,img.propertyNames())
.set('system:id', date)
}
var modis = MOD09
.filterDate('2015','2020')
.filterBounds(geometry)
.map(modisData)
print(modis)
Best Answer
This seems to work with explicit casts:
Not sure why your
.date()
approach is failing on MODIS though.https://code.earthengine.google.com/f383b8171ad11bc8be6d7b11b040bd0d