I am struggling with transforming a single image to a list and then exporting it to my drive.

I am using the ee.Reducer.toList() but the output looks like this: enter image description here

Insted of this:

enter image description here

When I print the featureCollection that is to be written to the file - it seems to contain all the data needed.

Here is my code:

var region = ee.Geometry.Polygon([
  [[-5, 40], [-5, 60], [-5, 60]]

//Dates of Interest
var start = ee.Date("2018-04-01");
var finish = ee.Date("2018-05-01");

var sen2 = ee.ImageCollection('COPERNICUS/S2_SR')
    return image


var sngl = ee.Image(sen2.first())

var list = sngl.reduceRegion({
  reducer: ee.Reducer.toList(),
  geometry: region,
  maxPixels: 1e8,
  scale: 10

// Make a feature without geometry and set the properties to the dictionary of means.
var feature = ee.Feature(null, list);

// Wrap the Feature in a FeatureCollection for export.
var featureCollection = ee.FeatureCollection([feature]);


// Export the FeatureCollection.
  collection: featureCollection,
  fileNamePrefix: 'field_test',
  folder: 'field_test',
  fileFormat: 'CSV'

Any ideas?

1 Answer 1


When you export a table, each row is a feature. Your code is making a collection with exactly one feature in it; you need to produce many features instead. Also, your variable 'list' is misnamed as it is a dictionary containing a list, not a list.

So, changing this section of your code will get you a table shaped like you are asking for:

var list = ee.List(sngl.reduceRegion({
  reducer: ee.Reducer.toList(),
  geometry: region,
  scale: 10

var featureCollection = ee.FeatureCollection(list.map(function (ndviValue) {
  return ee.Feature(null, {'NDVI': ndviValue});


The map on the list converts the list of numbers to a list of Features, and then can be converted to a FeatureCollection for export.

  • Many thanks @Kevin Reid Commented May 13, 2020 at 6:47

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.