I am trying to calculate stadistics for burn areas based on the number of pixels.

When running the code, GEE says too many pixels, I tried to solve it following the guides given by google developers but nithing worked. On the other hand I would like to know what the scale parameter means, for example is appropiate to use 30m for sentinel 2 imagery?

// create a function to derive extent of one burn severity class
// arguments are class number and class name
var areacount = function(cnr, name) {
 var singleMask =  classified.updateMask(classified.eq(cnr));  // mask a single class
 var stats = singleMask.reduceRegion({
  reducer: ee.Reducer.count(),               // count pixels in a single class
  geometry: area,
  scale: 50,
  maxPixels: 1e10,
  bestEffort: true
  • 4
    ALL CAPS question titles garner downvotes for SHOUTING. Please Edit your question title to be in proper title case (initial word and proper nouns with first letter capitalized)
    – Vince
    Commented Mar 17, 2020 at 13:05

1 Answer 1


I think the docs do a pretty good job of describing the scale parameter (https://developers.google.com/earth-engine/scale). For example, if you reduceRegion() with an ee.Reducer.count() at a scale of 1000, think of if as changing the resolution of your image so the width and height of each pixel is 1000 meters. These 1000 meter pixels are then counted. From that follows that a smaller scale give a higher count, as more pixels will fit into your region.

maxPixels is just the maximum number of pixels reduceRegion() will process. Again, a smaller scale will lead to more pixels, and that might force you to increase the maxPixels value.

bestEffort will automatically increase the scale so you don't exceed the maxPixels. In your case, that's probably a bad idea to specify this property, since you almost certainly need to know the exact scale used when doing the pixel count. That count doesn't mean much otherwise.

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.