0

We are trying to do the surface reflectance correction using Python codes in Spyder. The study area is defined as a polygon geometry and it's a fairly large area. We want to get all sentinel images that covered the study area in 2017 and correct all of them.

However when we run the python code, error popped up saying there is too many pixels in our study area:

EEException: Error in map(ID=20170103T172712_20170103T173023_T13QGE):
Image.reduceRegion: Too many pixels in the region. Found 220713615, but only 10000000 allowed.

We tested - the pixel number 220713615 should be the pixels of the geometry we specified (the study area). We tried a smaller geometry with less than 10000000 pixels, and the code worked perfectly.

Weird things are: we are not using any "Image.reduceRegion" function in our code, and it doesn't seem to have anything to do with the pixels of the study area if we want to surface correct the satellite images.

closed as off-topic by PolyGeo Jul 24 at 20:06

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • For coding questions please always include a code snippet that illustrates what you have tried and where you are stuck. – PolyGeo Jul 24 at 20:07
2

As the error says, the max pixel's allowed is 10000000. You can change this to suit your data:

image.reduceRegion({
  reducer: x,
  geometry: x,
  scale: x,
  maxPixels: 1e9
});

Not the answer you're looking for? Browse other questions tagged or ask your own question.