I am trying to filter a raster asset that uses numeric values to define land uses. My initial purpose is to use a list of values to filter all the areas corresponding to bushes (codes 410, 420 and 430).
With the updateMask method this can be easily done with the following code:
var landuse = ee.Image('users/xxx/cover2014');
var masked = landuse.updateMask(landuse.eq(410).or(landuse.eq(420)).or(landuse.eq(430)));
My problem relies on the fact that I want to use another land uses through a checkbox, so I was thinking in a code like this (I did not include the code used for panel and checkbox):
var forest = ee.List([211, 212, 221, 222, 231, 232, 241, 251]);
var bush = ee.List([410, 420, 430, 440, 450]);
var filterList = forest.cat(bush);
var landuse = ee.Image('users/xxx/cover2014');
var masked = landuse.updateMask(landuse.eq(filterList));
Map.addLayer(masked);
Sadly, the updateMask method gives an error because I am using a list instead of a image. I have also tried with the operator 'in', 'inList', without success.
Is there any way to use values contained in a list to update the mask or filtering a raster asset?
EDIT:
The final code, using the provided solution is:
var forest = ee.List([211, 212, 221, 222, 231, 232, 241, 251]);
var bush = ee.List([410, 420, 430, 440, 450]);
var filterList = forest.cat(bush);
var landuse = ee.Image('users/xxx/cover2014');
var masked = landuse.updateMask(landuse.eq(ee.Image.constant(filterList)).reduce(ee.Reducer.anyNonZero()));
Map.addLayer(masked);