I have Sample RGB combination from 3 different Bands
// Input RGB imagery
var image = ee.Image("users/k2yulianto/Exercise/Ras/Imagery");
// Use Tree bands from RGB Imagery
var bands = ['b1', 'b2', 'b3'];
var b1 = ['b1'];
var b2 = ['b2'];
var b3 = ['b3'];
// Display the inputs imagery
Map.addLayer (image, {bands: ['b1', 'b2', 'b3'], max: 1, gamma:1, opacity:0.80} , 'RGB imagery',true);
Map.setCenter (101.4476, 0.4925, 12);
And I have also sampling point distribution on top of RGB Imagery.
// Sampling point on top of RGB imagery to identify 4 diferent class
var Sampling = ee.FeatureCollection("users/k2yulianto/Exercise/Sampling/Sampling");
Map.addLayer (Sampling, {opacity:0.80},'Sampling point', true);
Based on the sampling point, I am to produce decision tree using WEKA to distinguish the type of class on RGB imagery.
//var exercise = ee.Algorithms.if(condition,truecase,falsecase)
var exercise = ee.Algorithms.If(b2 <= (0),(ee.Algorithms.If(b3 <= (0),"Sample 1","Sample 2")),(ee.Algorithms.If(b1 <= (0),"Sample 3","Sample 4")));
print('Imagery output: ',exercise);
I want to display if-then-else condition into an image classification.
// Display the 4 Class exercise output imagery
var RGBPalette =
['#5f932c', // Class 01
'#bdff09', // Class 02
'#fdf613', // Class 03
'#abfffb', // Class 04
];
Map.addLayer(exercise,{min: 0, max: 4, palette: RGBPalette}, 'Exercise imagery');
After I run the scripts, I got an error warning:
Cannot add an object of type to the map.
Here is my full code:
https://code.earthengine.google.com/77b2238d1a628c59dfa440a27adfa378
How can I solve this?
arcgis-desktop
?