Google Earth Engine Export – Export Sentinel 2 EVI2 Time-Series as CSV to Google Drive

exportgoogle-earth-enginegoogle-earth-engine-javascript-apisentinel-2

I am new to GEE. I need to export Sentinel-2 evi2 time-series of multiple points as a CSV file to Drive using GEE.

I based my code:

// Vou calcular o evi2 para a minha região de interesse, que não
// é um ponto, mas vários pontos.
var table = ee.FeatureCollection("users/marciobcure/pontos_dexter").limit(4);
var geometry = table.geometry();
print(geometry);
// Sentinel 2
var idCollection = 'COPERNICUS/S2_SR_HARMONIZED';

//Definição da ImageCollection e Filtros Geoespaciais

 var img = ee.ImageCollection(idCollection)
        .filterDate('2015-01-01', '2022-01-31')//filtro de intervalo de período
        .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 30))//filtro de nuvens
        .filter(ee.Filter.bounds(geometry))
        //.mosaic();//função redutora
        .select(['B11', 'B8', 'B4']);

var s2evi2 = img.map(function(img){
   var date = img.get('system:time_start');
   var evi2 = img.expression(
    '2.5*(NIR-RED)/(NIR+(2.4*RED)+1)', {
      'NIR': img.select('B8').divide(10000),
      'RED': img.select('B4').divide(10000)
}).set('system_time_start', date).rename('EVI2');
//  return   ;
  return img.addBands(evi2);
});

// Create a function that takes an image, calculates the mean over a
// geometry and returns the value and the corresponding date as a 
// feature.
var createTS = function(img){
  var date = img.get('system_time_start');
  var value = img.reduceRegion(ee.Reducer.mean(), geometry).get('EVI2');
  var ft = ee.Feature(null, {'system:time_start': date, 
                             'date': ee.Date(date).format('Y/M/d'), 
                             'value': value});
  return ft;
};

// Apply the function to each image in modisLST.
var EVI2 = s2evi2.map(createTS);
print(EVI2);
// Create a graph of the time-series.
// var graph = ui.Chart.feature.byFeature(EVI2, 'system:time_start', 'value');

// print(graph.setChartType("ColumnChart")
//           .setOptions({vAxis: {title: 'EVI2 [S2]'},
//                         hAxis: {title: 'Date'}}));

// Export the time-series as a csv.
Export.table.toDrive({collection: EVI2, selectors: 'date, value'});

on the answer of Bert Coerver in this link.

I got the following message error: ImageCollection (Error) Error in map(ID=20181213T131231_20181213T131234_T23KMA): Date: Parameter 'value' is required.

What is wrong?

Best Answer

You use the property name incorrectly. Change all system_time_start to system:time_start.

enter image description here