7

I am relatively new to Google Earth Engine, currently working on finding mean NDVI for command areas of different tube wells in my study area.

What I have done so far is:

  • Filtered L8 image collection for the months of Jan and Feb for 2014-2019

  • Imported the feature collection which contains the command areas

  • Masked out clouds, and mosaiced according to acquired date (which reduced the size of image collection from 377 to 87)

What I am trying to do is, to apply reduceRegions and map it to the image collection, so that I can export a table of 613 (number of features in the Fc, sorted by ID) * 87 (images in the image collection, sorted by date)

When I try to do reduce regions for a single image, the output is a feature collection with 613 features and columns corresponding the the attributes of the features

var reduced = mapNDVI.first().reduceRegions({
    collection:cmdArea , 
    reducer:ee.Reducer.mean(), 
    scale: 30
  });

which gives

featureCollection (613 elements, 46 columns)
type: FeatureCollection
columns: Object (46 properties)
features: List (613 elements)

When I try to map this over the image collection of 87 L8 images,

var reduced = mapNDVI.map(function(image){
  return image.reduceRegions({
    collection:cmdArea , 
    reducer:ee.Reducer.mean(), 
    scale: 30
  });
});

this gives

FeatureCollection (87 elements, 0 columns)
type: FeatureCollection
columns: Object (0 properties)
features: List (87 elements)

Can anyone help me with how to go abou mapping reduce regions over an image collection to obtain a table of (number of features * number of images)?

Please find the code below: https://code.earthengine.google.com/7dd30af72b3685f673d4d1afa97334c4

6

If I understand you correctly, you're just missing one step.

var reduced = mapNDVI.map(function(image){
  return image.reduceRegions({
    collection:cmdArea , 
    reducer:ee.Reducer.mean(), 
    scale: 30
  });
});

This gives you a collection of collections. To turn this into a "table", you just flatten it.

var table = reduced.flatten();

This gives you a collection with 53,331 features. You can then sort this as you want and finally export it.

3
  • Right. Thanks for putting your time in.
    – NOUFA
    Feb 12 '20 at 4:22
  • @Daniel how can we remove the column with geometry from the resulting table? May 11 '20 at 23:21
  • If you're exporting to Google Drive, you can specify the selectors property, providing a list of the columns you want. Just don't include .geo in that list. May 12 '20 at 7:13

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