TransWikia.com

Pixel-based NDVI time series - Google Earth Engine

Geographic Information Systems Asked by Ma dujuanE on September 2, 2020

I am a newcomer using GEE and now I want to do a NDVI time series. The condition is that it must be based on the result of the pixel, and it need to displayed on the map. I just made the NDVI time series, but there is no ideas as a pixel based.

One Answer

Maybe this will help you

var l8 = ee.ImageCollection("COPERNICUS/S2")
    .filterDate('2018-06-01', '2019-06-01');
var ndvi = l8.map(function(image) {
  return image.select().addBands(image.normalizedDifference(['B8','B4']));});
var panel = ui.Panel();
panel.style().set('width', '400px');
var intro = ui.Panel([
  ui.Label({value: 'NDVI Chart Inspector',
    style: {fontSize: '20px', fontWeight: 'bold'}  }),
  ui.Label('Click a point on the map to inspect.')]);
panel.add(intro);
var lon = ui.Label();
var lat = ui.Label();
panel.add(ui.Panel([lon, lat], ui.Panel.Layout.flow('horizontal')));
Map.onClick(function(coords) {
  lon.setValue('lon: ' + coords.lon.toFixed(5)),
  lat.setValue('lat: ' + coords.lat.toFixed(5));
  var point = ee.Geometry.Point(coords.lon, coords.lat);
  var dot = ui.Map.Layer(point, {color: 'FF0000'});
  Map.layers().set(1, dot);
  var ndviChart = ui.Chart.image.series(ndvi, point, ee.Reducer.mean(), 500);
  ndviChart.setOptions({
    title: 'NDVI Over Time',vAxis: {title: 'NDVI'},
    hAxis: {title: 'date', format: 'MM-yy', gridlines: {count: 7}},
  });  panel.widgets().set(2, ndviChart);});
Map.style().set('cursor', 'crosshair');
ui.root.insert(0, panel);
Map.setOptions('SATELLITE')
Map.setCenter(35.84497, 32.01918, 3);

or change in the first line to other satellite like "LANDSAT/LE07/C01/T1_SR" if you change satellite don't forget to change the bands accordingly.

Answered by Harel on September 2, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP