0

I have this code that works perfectly for small rasters.

var image = ee.Image("users/parivash89/Cuneo_Reclassify")
  .toInt();

Map.addLayer(image);
Map.centerObject(image);

var classes = image.reduceToVectors({
  reducer: ee.Reducer.countEvery(), 
  scale: 10,
  maxPixels: 1e10
});

var result = ee.FeatureCollection(classes);

Map.addLayer(result);

// Export the FeatureCollection to a SHP file.
Export.table.toDrive({
  collection: result,
  folder: 'GEE_Polygonize',
  description:'Cuneo',
  fileFormat: 'SHP'
});

But gives me the following error while the raster input is large:

Layer 2: Tile error: Geometry has too many edges (3890235 > 2000000)

So I added this line :

// Simplify the feature
var featureSimple = ee.Feature(result).simplify({maxError: 10});

But it did not get simplified and I stil get the error. What should I change in my code? I need the resolution of 10m in my output so I cannot lower the resolution.

1 Answer 1

1

By the time the simplify can happen, it's too late, you've already generated the giant polygon. You will have to specify a larger scale to reduceToVectors. Based on the error message, it looks like you'll need a scale of about 20.

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.