I am trying to extract NDVI values by regions of a certain polygon shapefile. I need, as output a graph (or a table) where the regions are defined by a certain column, called 'FID_incend'. I need exactly this column because those are unique values that I will use afterwards to process other maps.
My code is:
var incendis1987 = ee.FeatureCollection("users/oriolbaena/incendis1987_identityLitology_87929702_s_0p9HA_simplified");
Map.centerObject(incendis1987, 12);
Map.addLayer (incendis1987,{color: 'FF0000'})
var addNDVI = function (image){
var ndvi= image.normalizedDifference(['B4', 'B3']).rename('NDVI');
return image.addBands(ndvi)
};
var dataset = ee.ImageCollection("LANDSAT/LT05/C01/T1_SR")
.filterBounds(incendis1987)
.filterDate('1984-01-01', '1995-12-31')
.map(addNDVI).select('NDVI');
var graph = ui.Chart.image.seriesByRegion({
imageCollection: dataset.select('NDVI'),
regions: incendis1987,
reducer: ee.Reducer.mean(),
scale: 30,
seriesProperty: FID_incend,
})
.setChartType('ScatterChart')
.setOptions({title: 'NDVI Incendis1987 dates1984-1995', vAxis: {title:'NDVI'},
lineWidth: 1,pointSize: 2,});
print(graph)
print ('I love JavaScript (L)')
As you can see, attibutes of my table include the column 'FID_incend':
The shp can be found here: https://code.earthengine.google.com/?asset=users/oriolbaena/incendis1987_identityLitology_87929702_s_0p9HA_simplified