I have computed NDVI for January 2018 to December 2018 from Landsat images that give 21 NDVI bands. I have a shapefile with three polygons; I would like to have three time-series NDVI values corresponding to the polygons in the given shapefile.
Imports (2 entries) var L8: ImageCollection “USGS Landsat 8 Collection 1 Tier 1 and Real-Time data TOA Reflectance” var roi: Table users/user_name/sample_shapefile
// NDVI function
function addNDVI(image) {
users/user_name/sample_shapefilevar ndvi = image.normalizedDifference(['B5', 'B4']);
return image.addBands(ndvi);`
}
// Date range 2018 jan to dec
var filtered = L8.filterDate('2018-01-01', '2018-12-31')
.filterBounds(roi);`
var with_ndvi = filtered.map(addNDVI);
var ndvi = with_ndvi.select('nd');
var dt = ndvi.reduceRegion({
reducer: ee.Reducer.mean(),
geometry: roi.geometry(),
scale: 30,
});
print(dt)
I would like to receive three time-series NDVI values one for each polygon in the given shapefile.