I'm new to the GEE platform.
How can I create a time series analysis (vegetation indices) of a particular shape?
would like to export in table form
var OLI = ('LANDSAT/LC08/C01/T1_RT_TOA');
//lOCALIZAÇÃO
var shp = ee.FeatureCollection(table);
// DEFINIÇÃO DO CENTRO DA ÁREA DE ESTUDO
Map.centerObject(shp);
// SELEÇÃO IMAGEM LANDSAT EM FUNÇÃO DO TEMPO E LOCALIZAÇÃO
var imagery = ee.ImageCollection(OLI)
var collection = ee.ImageCollection(imagery
.filterMetadata('CLOUD_COVER','less_than',3)
.filterDate('2015-01-01','2019-09-17')
.filterBounds(shp));
// ADICIONANDO AS IMAGENS CLIPADAS NO CONSOLE DIREITO
print ("Coleção de Imagens clipadas: ", collection);
// MOSAICO E CLIP DA IMAGEM
var clipimagem = collection.mosaic().clip(shp);
// ADICIONANDO AS IMAGENS CLIPADAS NO CONSOLE DIREITO
print("Imagens Cor verdadeira: ", clipimagem);
//------------------ CALCULOS ÍNDICES DE VEGETAÇÃO ---------------------------
// Use the normalizedDifference(A, B) to compute (A - B) / (A + B)
var ndvi = clipimagem.normalizedDifference(['B5', 'B4']);
// Use the NBR (A, B) to compute (A - B) / (A + B)
var nbr = clipimagem.normalizedDifference(['B5', 'B7']);
var evi = clipimagem.expression(
'2.5 * (nir - red) / (nir + 6 * red - 7.5 * blue + 1)',
{
red: clipimagem.select('B4'), // 620-670nm, RED
nir: clipimagem.select('B5'), // 841-876nm, NIR
blue: clipimagem.select('B2') // 459-479nm, BLUE
});
var savi = clipimagem.expression(
'2.0 * (nir - red) / (nir + red + 1.0)',
{
red: clipimagem.select('B4'), // 620-670nm, RED
nir: clipimagem.select('B5'), // 841-876nm, NIR
});
// ADICIONANDO LAYER AO MAPA
// Make a palette: a list of hex strings.
var palette = ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718',
'74A901', '66A000', '529400', '3E8601', '207401', '056201',
'004C00', '023B01', '012E01', '011D01', '011301'];
Map.addLayer(shp.draw({color: 'ffffff', strokeWidth: 5}), {},'Parque Estadual do Cantão');
Map.addLayer(clipimagem, {bands:'B5,B4,B3'}, 'FALSA COR');
Map.addLayer(ndvi, {min:0, max:1, palette: palette}, 'NDVI');
Map.addLayer(nbr, {min:0, max:1, palette: palette}, 'NBR');
Map.addLayer(evi, {min:0, max:1, palette: palette}, 'EVI');
Map.addLayer(savi, {min:0, max:1, palette: palette}, 'SAVI');
Best Answer
You will have to make a long addition to your script to extract not from the mosaic, but from a collection for each of your indices.
Then you reduce the images with
.reduceregion()
and add it as a property to a feature.After that, you create a collection of the feature so that it can be exported to a csv.
======================
EDIT
Ah, I missed something.
In your question you mention:
When testing it, as I don't have access to your "table" I just drew a polygon, and used that as "shp". But I just noticed that your "table" is actually a Feature Collection.
If it is just one polygon that you have in your collection, you can change your early code to this.
If it is actually a collection, you will have to modify the functions to be mapped to a collection, rather than a feature.