I want to compute a total area of a large raster dataset using .reduceRegion(), but receive the "Earth Engine capacity exceeded" Error. Is it possible to overcome it? For example create a vector grid over an AOI, map .reduceRegion() over each sell and then sum up the results?

The code is following (also available on Earth Engine):

var aoi = ee.Geometry.Polygon(
        [[[1.0167888602549056, 32.24107677376602],
          [1.0167888602549056, 3.3274515320624296],
          [42.457218547754906, 3.3274515320624296],
          [42.457218547754906, 32.24107677376602]]], null, false);

var dataset = ee.Image('JRC/GSW1_0/GlobalSurfaceWater');
var selected_data = dataset.select('occurrence').clip(aoi);

var area = selected_data.reduceRegion({
      reducer: ee.Reducer.sum(),
      geometry: aoi,
      scale: 15,


Map.addLayer(selected_data, {}, 'Target image');
Map.addLayer(aoi, {}, 'AOI');

There is a limit to resources that you can use on-the-fly and unless that is lifted for you, you can not bypass that. These limits apply when you are trying to view results in the console with print or adding a layer to the map. However, I found a workaround to your issue. Check out the code in earth engine here

I just created a feature collection with one point feature (can be anything really, it's not important) with the area set as one of its properties.

var dummyFC = ee.FeatureCollection(ee.Feature(ee.Geometry.Point([1,1])).set('area',area));

Then i just exported the feature collection as CSV to the drive and got a CSV result.

  fileNamePrefix: 'area_test',

If you are not interested in running it yourself or don't want to wait for the result of this exact operation. I got the the value 1.3716314113697263E11 (137163141136.97263) as result.

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.