0

I have multiple points representing different crops for an area (say 100 per crop, and 5 types of crops). I compute the Sentinel2 NDVI for a period of one year. Even if I filter for just one type of crop ('landcover',1) it collapses and returns: "Error generating chart: Collection query aborted after accumulating over 5000 elements." I would like to get on line per point (after filtering for just one type of crop if necessary), so then I can export and plot it in R.

var geometry = ee.FeatureCollection("users/delaralfonso/ROIs_CBA/WPT_Tucuman_E1819_51");
//geometry = geometry.filter(ee.Filter.eq('landcover',1));
//geometry = geometry.limit(100)


var s2 = ee.ImageCollection("COPERNICUS/S2")
  .filterDate('2018-10-01','2019-04-01')
  .filter(ee.Filter.lt("CLOUDY_PIXEL_PERCENTAGE", 5))
  .filterBounds(geometry)

function getNDVI (image){
  var red = ee.Image(image.select('B4'));
  var nir = ee.Image(image.select('B8A'));
  var ndvi = (nir.subtract(red)).divide(nir.add(red)).rename('ndvi');
  return image.addBands(ndvi);
}
var collection = s2.map(getNDVI).select('ndvi');
Map.addLayer(collection,{}, "Collection NDVI", false)

// Create a time series chart.
var NDVITimeSeries = ui.Chart.image.seriesByRegion(
    collection, geometry, ee.Reducer.mean(), 'ndvi', 20, 'system:time_start', 'landcover')
        //.setChartType('LineChart')
        .setChartType('ScatterChart')
        .setOptions({
          title: 'Series temporales NDVI para los ditintos ROIs',
          vAxis: {title: 'NDVI'},
          lineWidth: 1,
          pointSize: 4});
print(NDVITimeSeries);

Any workaround for my issue? Maybe not visualize but just export it?

marked as duplicate by Community Aug 28 at 12:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.