While selecting pixels having specific values using following code,

////////////////// Dynamic World ////////////////////////
var dw = ee.ImageCollection('GOOGLE/DYNAMICWORLD/V1')
             .filterDate('2023-01-01', '2023-03-31')

// Select label layer
var classification = dw.select('label');
var dwComposite = classification.reduce(ee.Reducer.mode());
var water = dwComposite.filter(ee.Filter.or(
  ee.Filter.eq('label_mode', 0),
  ee.Filter.eq('label_mode', 8)

I'm having the following error,

Line 17: dwComposite.filter is not a function

please help me to get the desired output.

1 Answer 1


I got the desired output by following corrections,

var water =dwComposite.eq(0).or(dwComposite.eq(8))
Map.addLayer(water, {}, 'water');


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.