I have a function that takes a feature and creates a buffer around it.

createBuffer = function(feature){

  var AOI = feature.geometry().buffer(3000);

  return ee.Feature(AOI).copyProperties(feature);

When I run this function on a collection that contains polygons that have coastlines, the fractal nature of the coastline makes the buffering take a while, the result is delivered to another function to do imageCollection calculations based on the new buffered feature.

In some cases (though none that I can replicate here) it leads to a The operation timed out.

What can be done to avoid these timeouts?


Have you tries using simplify() on your geometry?

var AOI = feature.geometry().simplify(1000).buffer(3000);

It worked considarably faster and the buffer you create won't differ that much. At least, I tried it on a 4618 vertices linearRing I had. If your simplify maxError is smaller than your buffer size, the outcome won't be very different.

  • Worked perfectly. Thanks. The 'simplify()' function solved the timeout issue. Because it is a coastline, and the simplification of the vertices doesn't affect the outcome, as beyond it is the sea, the pixels there are of no effect to the calculation. – Sean Roulet Jan 23 at 18:18

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.