0

I'm trying to apply a rule to NOOA NDVI the already classified region to only display dense vegetation areas but it's saying ndvi is not a function, any help will be much appreciated. Here is the code:

//collecting data using ndvi
var good = ee.ImageCollection('NOAA/CDR/AVHRR/NDVI/V5')
                  .filter(ee.Filter.date('2018-05-01', '2018-06-01'))
                  //.median()
                  //.good.lt(0.27).and(good.gt(0.18))
                  //.map(function(good){return good.lt(0.18).and(good.gt(0.27))})
                  .map(function(good){return good.clip(roi)});

Map.setCenter (37.577717495842506,0.3597340638009545,12);
var ndvi = good.select('NDVI')
var ndvi2 =ndvi
          .where(ndvi.gt(0.27).and(ndvi.lte(0.36)), 4)
          .where(ndvi.gt(0.36).and(ndvi.lte(0.74)), 5)
var ndvi2 = ndvi2.clip(roi);

The error shows this

Line 14: ndvi.gt is not a function
new name
  • 15,861
  • 19
  • 68
  • 114

1 Answers1

0

I would need to see more of your script to give you a full answer, but from what you have provided, it appears that ndvi is an ee.ImageCollection() and the .gt() and .lte() functions only work on ee.Image(). You will need to create a function that maps your intended rule over each image in the image collection to get what you want.