I'm trying to generate a table with my GNDVI points value from a time series. I have a feature collection of my polygons, another feature collection of my random points in the polygons. I have a image collection as well and I want a table with the points value in every polygon for every date in the time series. I joined the two feature collections and I don't know how to proceed from here.

How do I do that?

my code:

var fc = ee.FeatureCollection(user_account+folder+shpfile_name);
var S2 = ee.ImageCollection(image_collection)
        .filterDate(first_date, last_date)
        .filterMetadata('CLOUDY_PIXEL_PERCENTAGE', 'less_than', 18);

print(fc)           // CRS must be WGS84 (for the shapefile)          

//Image Expression for calculating GNDVI----------------------------------------------
var band_1 = 'B3'
var band_2 = 'B8'

var addGNDVI = function(image) {
  var GNDVI = image.expression(
    'B3': image.select('B3'),
    'B8': image.select('B8'),

  //NDVI index
  return image.addBands(GNDVI.add(ee.Image(0.0)));
  //Add 0.0 value to GNDVI (currently not in use)
var t = ee.FeatureCollection.randomPoints(fc, 100)

// Calculate GNDVIfor images in the Image collection 
var S2_withGNDVI = ee.ImageCollection(S2).map(addGNDVI);          

// Show image of mean GNDVI (over image collection) on GEE. 
var scene = ee.Image(S2_withGNDVI.mean());

// Prepare palette for image display     
var palette = ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718',
          '74A901', '66A000', '529400', '3E8601', '207401', '056201',
          '004C00', '023B01', '012E01', '011D01', '011301'];
          //palette for GNDVI image on GEE.

// Add GNDVI image and shapefile on GEE platform (min;max are range values)
Map.addLayer(scene.select('GNDVI'), {min: min_v, max: max_v, palette: palette}, 'GNDVI', 1, 0.85);
Map.addLayer(fc.style({color: 'e02406', fillColor: '00000000'}));    

//Export GNDVI Time Series into a Scatter Chart and a CSV format              
var TimeSeries = Chart.image.seriesByRegion(
S2_withGNDVI, fc, ee.Reducer.mean(), 'GNDVI', 3, 'system:time_start', fc_ID)
      title: 'GNDVI Time Series For Shift 1-2 Argentina',
      vAxis: {title: 'GNDVI'},
      hAxis: {title: 'Date'},
      lineWidth: 1,
      pointSize: 4,
      series: {
// Display.

// Define a spatial filter as geometries that intersect.
var spatialFilter = ee.Filter.intersects({
  leftField: '.geo',
  rightField: '.geo',
  maxError: 1

// Define a save all join.
var saveAllJoin = ee.Join.saveAll({
  matchesKey: 'points',

// Apply the join.
var intersectJoined = saveAllJoin.apply(fc, t, spatialFilter);


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.