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.


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.')]);
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);
    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.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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.