I've been working on a classification scheme, and have 6 different classes i wish to map. Everything has been already done in terms of finding the classifications. the only thing I am struggling on now is how to import all 6 classes (6 classes but 7 vars) onto the same map, without them going on top of one another.
My end goal is for it to look like this:
Code used:
var image = ee.Image(landsat.filterDate ('2018-01-01', '2018-03-01').filterBounds(point).sort('CLOUD_COVER').first());
//print image
print('a landsat scene', image);
//define parameters
var green = image.select('B3');
var swi = image.select('B6');
var mndwi = green.subtract(swi).divide(green.add(swi)).rename('MNDWI');
var mndwipara = {min: 0, max: 0.7, palette: ['white', 'blue']};
Map.addLayer(mndwi, mndwipara, 'MNDWI');
//apply threshold to select only positive pixels
var lake_mask= mndwi.gt(0);
Map.addLayer(lake_mask);
//image reducer
var meanDictionary =image.reduceRegion({
reducer: ee.Reducer.mean(),
geometry: image.geometry(),
scale: 30,
maxPixels: 1e9
});
// The result is a Dictionary. Print it.
print(meanDictionary);
//classification attempt - scum
var scum=image.expression(
'(nir)*0 + (nir < 0.018)*1', {
'nir': image.select('B5'),
'red': image.select ('B4'),
'green': image.select('B3'),
});
//classification attempt - sediment
var sediment=image.expression(
'(nir)*0 + (nir > 0.018 && red > green && green/nir < 1.3 && red/green> nir/red)*1', {
'nir': image.select('B5'),
'red': image.select ('B4'),
'green': image.select('B3'),
});
//classification attempt - lowbiomass
var lowbiomass=image.expression(
'(nir)*0 + (nir > 0.018 && red < green && green > 0.065 && nir < red)*1', {
'nir': image.select('B5'),
'red': image.select ('B4'),
'green': image.select('B3'),
});
//classification attempt-scum
var scum=image.expression(
'(nir)*0 + (nir > 0.018 && red < green && green > 0.065 && nir > red && nir/red > 4.07)*1', {
'nir': image.select('B5'),
'red': image.select ('B4'),
'green': image.select('B3'),
});
//classifcation attempt bleached scum
var bleached_scum=image.expression(
'(nir)*0 + (nir > 0.018 && red > green && green/nir > 1.3 && green > 0.065)*1', {
'nir': image.select('B5'),
'red': image.select ('B4'),
'green': image.select('B3'),
});
//classification attempt - microphytobenthos
var microphytobenthos=image.expression(
'(nir)*0 + (nir > 0.018 && red > green && green/nir < 1.3 && red/green< nir/red)*1', {
'nir': image.select('B5'),
'red': image.select ('B4'),
'green': image.select('B3'),
});
//classification attempt - highbiomass
var highbiomass=image.expression(
'(nir)*0 + (nir > 0.018 && red < green && green > 0.065 && nir > red && nir/red < 4.07)*1', {
'nir': image.select('B5'),
'red': image.select ('B4'),
'green': image.select('B3'),
});