0

I tried to generate a time series chart of NDVI using Sentinel-2 data for multiple points. But the chart has vertical plots with two values for same point and same date.

Here is the code:

var points = ee.FeatureCollection([
ee.Feature(geometry2, {label: 'm1'}),
ee.Feature(geometry3, {label: 'm2'}),
ee.Feature(geometry4, {label: 'm3'}),
ee.Feature(geometry5, {label: 'm4'}),
ee.Feature(geometry6, {label: 'm5'}),
ee.Feature(geometry7, {label: 'm6'}),
ee.Feature(geometry8, {label: 'm7'}),
ee.Feature(geometry9, {label: 'm8'}),
ee.Feature(geometry10, {label: 'm9'}),
ee.Feature(geometry11, {label: 'm10'})
]);

Map.addLayer(points);

// NDVI calculation



var addNDVI = function(image) {
  return image.addBands(image.normalizedDifference(['B8', 'B4']));

};

  var with_ndvi = puli.map(addNDVI);

  var rgb_vis = {min: 0, max: 5000, bands: ['B4', 'B3', 'B2']};
  Map.addLayer(puli, rgb_vis, 'RGB');
  Map.addLayer(with_ndvi, {bands: 'nd', min: 0, max: 1}, 'NDVI');



   // Time Series Analysis for NDVI

var TimeSeriesndvi = ui.Chart.image.seriesByRegion(with_ndvi,points,ee.Reducer.mean(),'nd',200, 'system:time_start', 'label')
.setChartType('ScatterChart')
        .setOptions({
          title: 'NDVI variations',
          vAxis: {title: 'NDVI'},
          lineWidth: 1,
          pointSize: 4,
          series: {
          // 0: {color: 'FF0000'}, 
          // 1: {color: '00FF00'},  
          //   2: {color: '0000FF'}, 
}});
print(TimeSeriesndvi);
0

Alternatively, there's a way to do that in LV.

  • Open LV and locate an area of your interest and then highlight it with AOI tool.
  • Click on “Time series analysis” icon on the left of the screen
  • Set the values needed and hit "apply"

enter image description here

You can then export the data wherever you need it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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