1

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?

1 Answer 1

3

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

enter image description here

1
  • It worked well. Thank you!! However, I faced another challenge because the values are not identified by sample id. Should I open another Question about this issue or someone can help me here? Commented Feb 2, 2023 at 17:39

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.