I posted this in the developers forum as it sounds to me like an internal error rather than an error in the code but I've not received a response so I'm trying my luck here.

I'm trying to create a DOY band on an image collection. I found a similar question on stackexchange which includes a function for doing this (Add a date (day of year) band to each image in a collection using Google Earth Engine). This code works fine.

When I try to run the function on my ImageCollection I get an error message:

ImageCollection (Error) Error in map(ID=20170601T102019_20170601T102022_T33UUU): Image.date: Image does not have a valid system:time_start property!

This sounds to me like there is an error in the metadata in one of the images in my collection. Can anyone help solve this?

NB. 'aoi' is a multipolygon shapefile.

Here is a link to my code in gee:


  • Please remember to include your code in the body of GIS SE questions. Links fail over time and cannot be indexed to locate the question.
    – Vince
    May 3, 2019 at 12:17

1 Answer 1


When you divide or multiply an image, it loses its original properties. Replace your function by explicite copying the original properties:

function maskS2clouds(image) {
  var qa = image.select('QA60');

  // Bits 10 and 11 are clouds and cirrus, respectively.
  var cloudBitMask = 1 << 10;
  var cirrusBitMask = 1 << 11;

  // Both flags should be set to zero, indicating clear conditions.
  var mask = qa.bitwiseAnd(cloudBitMask).eq(0)

  return ee.Image(image.updateMask(mask)
  .divide(10000).copyProperties(qa)).set('system:time_start', qa.get('system:time_start'));

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.