I have two layers: one which contains few seperated polygons, and one which has raster which I have uploaded (type feature collection). In addition, I have draw one for test (geometry).
My goal:
I want each polygon to get information based on its' location regard: how many pixels are in its' region that their value is lower than 0.2, between 0.2-0.4 ect.
What I have done: I have used code that I had and tried to do this iteration for each polygon.
The result: when running this with the GEE manual drawn polygon. calculation was done, but I got in the end imagecollection which contains this data in each feature properties. Also when I run this on my geometry (sometimes get error: geometry.geometry is not a function).
Code:
var c0204 = image.gt(0.2).lt(0.4).selfMask().reduceRegion({
reducer: ee.Reducer.count(),
geometry: geometry,
crs: 'EPSG:4326',
//maxPixels:1310361348,
scale: 20,
}).values().get(0);
This is a link to my code, let me know if the imports are unavilable.
https://code.earthengine.google.com/24f5e8f9ef310b96d632ef89454c00eb
My end goal: To have the count pixels data in table so I can know for each polygon how many pixels were found in each count category. or at least to have it as featurecollection and not as imagecollection