How can I copy "system:time_start" to other formulas from collection?

Like EVI:

var evi2020 = med2020.expression( '2.5 * ((NIR - RED) / (NIR + 6 * RED - 7.5 * BLUE + 1))', { 'NIR': med2020.select('B8'), 'RED': med2020.select('B3'), 'BLUE': med2020.select('B2') }).rename('EVI2020');

or to other formula:

var formula = image.expression( '(ndvi2019 - ndvi2018) / mean', { 'ndvi2019': image.select('ndvi2019'), 'ndvi2018': image.select('ndvi2018'), 'mean': image.select('mean') }).rename('formula');
  • 2
    Welcome to StackExchange, Kenobi. Before posting, take a quick tour to see the guidelines and rules in the forum. For future posts, make sure to have the code in the appropriate format. Lastly, for your own coding, it will be easier to not get lost if you simplify the code and not write it in one line.
    – AdoMath
    Jan 29, 2021 at 18:49

1 Answer 1


You can use .copyProperties(image, ['system:time_start']). An example below shows how to implement this command:

var addEVI = function(image) {
  return image.expression(
    '2.5 * ((NIR - RED) / (NIR + 6 * RED - 7.5 * BLUE + 1))', {
      'NIR': image.select('B5'),
      'RED': image.select('B4'),
      'BLUE': image.select('B2')})
      .copyProperties(image, ['system:time_start']);

In this example you create a function to add EVI values to each image in an image collection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.