I learned supervised classification through the example of Google Earth Engine, but in this example, I found that I cannot use Map.addLayer ()
to visualize the training data and test data. When I use this code:
Map.addLayer (trainingPartition, {'color': '# ff0000'}, 'train');
Map.addLayer (testingPartition, {'color': '# 3b8b00'}, 'test');
Nothing appears on the screen. Does anyone know why this is the case? Here are Key codes:
// Optionally, do some accuracy assessment. Fist, add a column of
// random uniforms to the training dataset.
var withRandom = training.randomColumn('random');
// We want to reserve some of the data for testing, to avoid overfitting the model.
var split = 0.7; // Roughly 70% training, 30% testing.
var trainingPartition = withRandom.filter(ee.Filter.lt('random', split));
var testingPartition = withRandom.filter(ee.Filter.gte('random', split));
Map.addLayer(trainingPartition,{'color':'#ff0000'},'train')
Map.addLayer(testingPartition,{'color':'#3b8b00'},'test')
Here is link: https://code.earthengine.google.com/1c2f985baf131e88b3dd96fbbab9b588