I'm starting with earth engine (ee) coding. Following instructions from https://developers.google.com/earth-engine/tutorial_api_07 I was able to put together some code and get a plot. But why the range of date on the plot goes from 2016 to 2018 while filterDate('2017-01-01', '2017-12-31')
?
var image = ee.Image(
s2.filterBounds(point)
.filterDate('2017-01-01', '2017-12-31')
.sort('CLOUD_COVER')
.first()
);
var addNDVI = function(image) {
var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI');
return image.addBands(ndvi);
};
var ndvi = addNDVI(image).select('NDVI');
var withNDVI = s2.map(addNDVI);
var chart = ui.Chart.image.series({
imageCollection: withNDVI.select('NDVI'),
region: point,
reducer: ee.Reducer.first(),
scale: 30
}).setOptions({title: 'NDVI over time'});
print(chart);