I have counted pixels with NDVI more than 0.2 for each polygon in a shapefile. Now I want to create choropleth map showing counts of pixels in each polygon. I want to how to create choropleth map after using reduceregions command.

green_areas mean pixels with NDVI more than 0.2 test is shapefile

var  sumgreen  =  green_areas.reduceRegions({
  collection: test # my shapefile 
  reducer: ee.Reducer.count(),
  scale: 10,
  • 1
    Please Edit your Question to contain a question. The question body should contain a description of the task, what you have tried, and the error or problem encountered. The title should be a brief summary of the Question topic, written after the question is completed.
    – Vince
    Jun 25, 2021 at 12:37
  • 1
    I rewrote your title, but a Question here is not just a statement of what you want to accomplish, but what you have tried and what error or problem you have encountered.
    – Vince
    Jun 25, 2021 at 12:47
  • Thanks for edits , which commands of GEE I should use to display count of green (more than 0.2 NDVI) pixels in each polygon . Polygon 1 has 35 , polygon 2 has 56 ...and son on . I did used paint empty image . Jun 25, 2021 at 12:52
  • 1
    Please Edit the Question to contain any details you want folks to see. Comments are really only to request clarifications.
    – Vince
    Jun 25, 2021 at 12:56

1 Answer 1


I've had success converting my featureCollection to raster then plotting the featureCollection (with transparency) on top of the raster.

// bottom-left, top-right
var aoi = ee.Geometry.Rectangle(43.1, 13, 47, 30);

var ecoregions = ee.FeatureCollection('RESOLVE/ECOREGIONS/2017')

var ecoregions_img = ecoregions
    properties: ['SHAPE_AREA'],
    reducer: ee.Reducer.first()

var area_values = ecoregions
  .filter(ee.Filter.greaterThan("SHAPE_AREA", 0))
print(area_values) // 0 - 72

Map.centerObject(ecoregions, 4)
Map.addLayer(ecoregions_img, {
  min: 0,
  max: 73,
  palette: ['FCFDBF', 'FDAE78', 'EE605E', 'B63679', '711F81', '2C105C']
Map.addLayer({eeObject: ecoregions.draw({color: 'black', strokeWidth: 1}), visParams: {}, opacity: 0.3});

enter image description here

See https://developers.google.com/earth-engine/guides/reducers_reduce_to_image

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.