It keeps given me the error that ndvi.gte is not a function, I shared my code below:

var images = sentinel.filter(ee.Filter.date(startDate,endDate)).filterBounds(geometry)

var ndvi = function(image){
  var ndv = image.normalizedDifference(['B8','B4']);
  return ndv.copyProperties(image,['system:index', 'system:time_start'])
var ndvi = images.map(ndvi);


var nd = ndvi.first().clip(geometry);

//Add Mask
var maskedNDVI = ndvi.gte(0.25);
var maskedNDVI = ndvi.updateMask(maskNDVI);
Map.addLayer(maskedNDVI,{min: 0, max: 1}, 'NDVI');

var chart = ui.Chart.image.seriesByRegion({
imageCollection: ndvi,
  reducer: ee.Reducer.mean(),
  scale: 250

1 Answer 1


To apply a threshold in image collection you must implement function in map loop. Here is corrected code: https://code.earthengine.google.com/92372c02aa57eab5acac372e12c7997d

  • Thank you for you answer it was really helpful! What I actually try to do is eliminating missing mixels by temporal gap filling with linear interpolation to get a smooth result from my model. Do you happen to have any recommendations on how to adapt my model further to realise this?
    – Eppez
    Feb 21 at 10:01
  • There is a tutorial for regression gap filling in google earth engine that I have used in my projects: spatialthoughts.com/2021/11/08/temporal-interpolation-gee Feb 21 at 10:05
  • Please accept the answer, you mentioned that is corrected. Feb 21 at 10:44

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.