0

I am exporting zonal statistics for 0.01-degree tiles in various locations in Africa. When I try to find the tile's 2010 percent forest cover from the GFCC data, I use a reducer function:


var gfcc_2010 = ee.ImageCollection('NASA/MEASURES/GFCC/TC/v3')
      .filter(ee.Filter.date('2010-01-01', '2010-12-31'))
      .select('tree_canopy_cover').mosaic();

//Mean pct FC per tile 2010
var mean_2010 = tiles.map(function(feature) {
  return feature.set(gfcc_2010.reduceRegion({
    reducer: 'mean',
    geometry: feature.geometry(),
    scale: 30
  }));
});

When I print mean_2010 in GEE, I can see the variable produced, called tree_canopy_cover. But when I export this feature collection as a table:

Export.table.toDrive(mean_2010, "gfccMeanGroup1_2010", "deforTilesGEE");

The resulting table only has the tile ID and geocoordinates. Why isn't tree_canopy_cover exporting? Full code here. (I use 0.5-degree tiles in this demo code so that I can print in the terminal).

4
  • Your "Full code here" link isn't publicly readable. The simplest way to share individual scripts is to use the "Get Link" function — you could create a script repository set to public, but "Get Link" makes links that work for anyone by default.
    – Kevin Reid
    Apr 6 at 1:49
  • That's exactly how I shared the code, so it's unclear why there's any issue.
    – C. Ashley
    Apr 6 at 14:14
  • It looks like you used “Copy Script Path” instead of "Get Link". “Get Link” links have a hexadecimal string, not the name of your saved script.
    – Kevin Reid
    Apr 6 at 16:47
  • Thank you for clarifying this, Kevin. I will use Get Link in the future.
    – C. Ashley
    Apr 10 at 19:11
2

Table exports assume that the first feature in a collection has all the properties of interest. If the first feature in tiles has no intersection with the image, it will not have the tree_canopy_cover property and the property will be missing from the entire export.

To avoid this, you can either filter the collection with .filter(ee.Filter.notNull(['tree_canopy_cover'])) after the .map() (so the non-intersecting features don't appear at all), or you can modify the map function so that it sets a value regardless.

2
  • Thank you for this tip. I am re-running now to see if it works.
    – C. Ashley
    Apr 6 at 14:31
  • It worked! Thank you Kevin!!
    – C. Ashley
    Apr 6 at 16:36

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.