0

I am trying to sample image and to get scatter plot of its' two bands- NDVI and db from senttinel 1. For some reason, probably because of the size of the shapefile, I get the error:

Error generating chart: Collection query aborted after accumulating over 5000 elements.

Collection query aborted after accumulating over 5000 elements

That's happens after I try to sample my image using this:

// Generate a sample of points within the region
var sample = pairedImage.sampleRegions(geometry, null,3);

I have playes with the last number in the funnction , I started with 50 but then went down to 30,10,5 ,1 and 3, but non of them worked and in all I have gotten the same error. is it possible that it happens because of the size of the image and there is nothing I can do?

Here is a link to my code:

https://code.earthengine.google.com/f967f358a45cc1c40ccc6d0373066270

My end goal: to be able to sample this image and create the chart

2

The collection you pass to ui.Chart.feature.byFeature() cannot contain more than 5000 features. In your case, your sample collection contains way more than 5000.

pairedImage.sampleRegions(geometry, null,3);

This samples your image at a scale of 3 meters. Since your image comes from Sentinel 2, it’s pointless to sampling at a scale smaller than 10 meters. Sampling your geometry at 10 meters gives you more than 600,000 features. That leaves you with two options: Sample at a larger scale or sample a smaller area. The below script samples at 100 meters:

https://code.earthengine.google.com/ce8aa2625c3bdf29e583364a19994dc4

| improve this answer | |

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.