I am extracting values from a Feature Collection over the MODIS Terra NDSI image collection using reduceRegions. I commented out the .filter(ee.Filter.neq('mean', null)) because I do want the null values. However, when I do, only some of the points have mean (the NDSI value) has a property. Do I need to add the mean value as it's own property in order to also extract null values?

I tried this: Google Earth Engine - add label to feature collection table/CSV and: GEE check only one sentinel tile instead of checking all of them when the featurecollection is in many tiles apporaches but no luck.

I am using a sample feature collection to make debugging easier. Below is the code:

var features = [
  ee.Feature(ee.Geometry.Rectangle(30.01, 59.80, 30.59, 60.15), {name: 'Voronoi'}),
  ee.Feature(ee.Geometry.Point(-73.96, 40.781), {name: 'Thiessen'}),
  ee.Feature(ee.Geometry.Point(6.4806, 50.8012), {name: 'Dirichlet'})

var fromList = ee.FeatureCollection(features);

var MOD10A1 = ee.ImageCollection('MODIS/006/MOD10A1')
                  .filter(ee.Filter.date('2018-01-01', '2018-05-30'))

var results = MOD10A1.map(function(image) {
    return image.reduceRegions({
      collection: fromList, 
      reducer: ee.Reducer.mean(), 
      scale: 30 
    })//.filter(ee.Filter.neq('mean', null)) //** i think this is why I was getting weird values for the GEE extraction
      .map(function(f) { 
      return f.set('imageId', image.date());


  collection: results,
  description: 'results', 
  fileFormat: 'CSV'

1 Answer 1


There's no difference between a null value in a feature and no value. If you want an "empty" property in the export where there was no result from the reduceRegions, then you can map over the results and add a default value. This is probably easiest by converting to a dictionary first and using combine with overwrite=false.

.map(function(f) {
  f = f.set(f.toDictionary().combine({mean: -1}, false))
  return f.set('imageId', image.date());
  • Thanks. I updated the script with your code. However, the new table now has the value -1 for all values (not just the empty values). Is there a way to have the values -1 for only empty values? Commented Mar 4, 2022 at 16:13
  • I see the problem. The overwrite option is inside the dictionary of values, not being used as an option. Use this instead: f = f.set(f.toDictionary().combine({mean: -1}, false)) Commented Mar 5, 2022 at 20:44
  • that fixed it, thanks! Commented Mar 7, 2022 at 23:21

Your Answer

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

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