I want to plot mean NDVI throughout the period of interest.

I have a polygon file loaded in Asset called boundary.

var start = ee.Date('2017-05-01'); //Dates of interest
var finish = ee.Date('2018-10-31'); 
var sentinel = ee.ImageCollection('COPERNICUS/S2')
 .filterDate(start, finish)
 .filter(ee.Filter.lte('CLOUDY_PIXEL_PERCENTAGE', 5)); 

var NDVI = sentinel.map(
    function(img) {
         return img.normalizedDifference(['B8','B4'])

print(ui.Chart.image.series(NDVI, boundary, ee.Reducer.mean(), 10));

But it turns out Error generating chart: No features contain non-null values of "system:time_start". How do I specify "system:time_start" argument?

  • I suspect your NDVI collection might be empty with such a low cloud cover percentage. What is the output of the print(NDVI) statement?
    – Kersten
    Oct 2, 2018 at 9:15
  • You are right. I ran into ImageCollection (Error) Collection query aborted after accumulating over 5000 elements. without .filterBounds(boundary). After editing the code, print(NDVI) shows ImageCollection COPERNICUS/S2 6 elements
    – M八七
    Oct 2, 2018 at 22:38
  • Just found NDVI doesn't have system:time_start but system:index. Is there a way to specify this argument?
    – M八七
    Oct 3, 2018 at 21:53

1 Answer 1


Use copyProperties method:

var NDVI = sentinel.map(
    function(img) {
         return img.normalizedDifference(['B8','B4'])
                  .copyProperties(img, ['system:time_start']);

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.