1

I have script in GEE which calculates for given geometry (reduceregions) the mean NDVI value for given period of time ans then suppose to export the table as CSV file when the polygon name is the columns ,the rows are the different dates and images, and the values are the mean NDVI value for each polygon for specific date. For some reason, when I check my result featurecollection I have in each image one polygon, but when I export it I get only the dates without the polygon names and they dissapear so my final excel looks like this: enter image description here

I'm also worried because seems like out of 5 polygons (A,B,C,D,E) it gets results only for B,C,D and little but for A, and I don't know if it has to do with the export -missing-polygons-name-error.

here is a link to my script+geometry:

https://code.earthengine.google.com/705aa58c4d43a2da2c073845ee563559

My end goal: To export my "result featurecollection" with the names off al the polygons and their mean value.

3

It seems like you will get the columns present in your first feature when exporting, unless you specify selectors. In your case, the first feature only contains system:index, time and .geo, so that's what you get in your CSV. The below code snippet find out which Name properties you've got and include them as selectors. It will take a few seconds until this is complete, so the Run button will not show up directly among your tasks.

// Evaluate properties to export (selectors), then export.
ee.List(triplets
  .distinct('Name')
  .aggregate_array('Name'))
  .cat(['.geo', 'time']) // Append more properties here as needed
  .evaluate(function (selectors) {
    // selectors must be a client-side object, so evaluate first.
    // If you know them up-front, just plug them in when exporting.
    var desc1 = 'table_demo_'
    Export.table.toDrive({
      collection: table1,
      description: desc1,
      fileNamePrefix: desc1,
      fileFormat: 'CSV',
      selectors: selectors
    })
  })

https://code.earthengine.google.com/1ba930c4c760724ae55d65099838debb

| improve this answer | |
  • 2
    Additionally, see these solutions: link – Kuik Apr 29 at 11:17

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.