Google Earth Engine – How to Convert Image to Vector and Resolve Computed Value Too Large Error

google-earth-engine

I am trying to convert a GEDI image to vector, but I get the error FeatureCollection (Error) Computed value is too large.
Here is my code.

var qualityMask = function(im) {
  return im.updateMask(im.select('quality_flag').eq(1))
      .updateMask(im.select('degrade_flag').eq(0));
};
var Bound  = ee.FeatureCollection(table);
var dataset1 = ee.ImageCollection('LARSE/GEDI/GEDI02_A_002_MONTHLY')
    .filterDate('2019-01-01', '2019-12-31')
    .map(qualityMask)
    .select('rh95')
    .median();
print(dataset1);
var clipped=dataset1.clipToCollection(Bound);
var gediVis = {
  min: 1,
  max: 60,
  palette: 'darkred,red,orange,green,darkgreen',
};
var sample=clipped.toInt();
var vectors = sample.reduceToVectors({
  geometry: Bound,
  crs: sample.projection(),
  scale: 30,
  maxPixels: 1e13,

});
print(vectors);

Best Answer

you have different solutions (for reference check Debugging guide) :

option 1:

print(vectors.limit(50))//or other number less than 5000;

option 2: export it as shapefile or csv

Export.table.toDrive({
collection:ee.FeatureCollection(vectors),
description: 'example',
folder:'test',
fileFormat: 'SHP',//or 'CSV'
});

an example here

Related Question