0

I am attempting to export a list of some NDVI data to my Google Drive. However, I am unable to export the list (when using export.table.toDrive) to my drive, as I get an error warning that my collection must be a feature collection. Below is my sad attempt at doing so.

var time_1 = image;

The above variable is just a single-band image containing NDVI values in a .tif (uploaded to GEE as an asset)

var reduced = time_1.reduceRegion(
  {reducer: ee.Reducer.toList(), scale: 275});

var extracted = reduced.get('b1')

var asList = ee.List(extracted); 

var funkshin = function(index) {
  var featurify = ee.Feature(index); 
  return featurify

var list_collect = asList.map(funkshin);
var collected = ee.FeatureCollection(list_collect)

print(collected);

When I execute the above code, I get a feature collection Error. it says the following:

collection, argument 'features': Invalid type.

Expected type: List Element.

Actual type: List Float

1 Answer 1

0

The items in the list are just numbers. You can't just call that a feature because a) features have geometries, and b) feature properties have names.

A correct conversion would be:

var featurify = ee.Feature(null, {b1: index})

However, you can skip all that by just using ee.Reducer.toCollection in the first place, instead of toList.

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.