I have this script in GEE to perform forest loss/gain changes from 2000-2020 over Italy based on Hansen Dataset.


I want to export the loss, gain, and tree cover layers to my google drive, however, it is running for about 20 hours and still has not exported. Does it mean there is a problem and the export will never happen or should I just wait because the area is big? Is there a way to accelerate the process?


Likely the reason it is running for so long has to do with the reduce region functions that are being run. It is hard to say whether or not it will fail or take many more hours, but reduce region is computationally expensive and over a large area is likely to cause problems. Using the “best fit” option or increasing the scale value might speed it up. This is from the debugging guide:


Although reduceRegion() greedily consumes enough pixels to trigger an exciting variety of errors, there are also parameters intended to control the computation, so you can overcome the errors. For example, consider the following inadvisable reduction:

Error — this code doesn't work!

var absurdComputation = ee.Image(1).reduceRegion({
  reducer: 'count',
  geometry: ee.Geometry.Rectangle([-180, -90, 180, 90],       null, false),
  scale: 100,

// Error: Image.reduceRegion: Too many pixels in the region.
//        Found 80300348117, but only 10000000 allowed.

This silly example is just for demonstration. The purpose of this error is to ask you whether you really want to reduce 80300348117 (that's 80 billion) pixels. If not, increase the scale (pixel size in meters) accordingly, or set bestEffort to true, to recompute a larger scale automatically. See the reduceRegion() page for more details about these parameters.


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.