I set up a script for supervised following the model from the EE tutorial -- Only thing I changed was to substitute Landsat 5 with Sentinel 2. The classifier does not give me any result -- Any idea why or how to fix it?

var point = ee.Geometry.Point([18.31, 20.85]);
var s2 = s2toa.filterBounds(point) //filter all scenes using point geometry from above (i.e. limit to Friuli)
  .sort('CLOUDY_PIXEL_PERCENTAGE', true).limit(300);
var s2Time1 = s2.select('B[2-8]');
var input = ee.Image(s2Time1.first()).clip(studysite);
Map.centerObject(studysite, 10);
Map.addLayer(input, {
  min: 750,
  max: 2100,
  bands: ['B8', 'B3', 'B2']
}, 'input image');
var training = basalt_train.merge(Sand_train);
var training = input.sampleRegions({
  collection: training,
  properties: ['class'],
  scale: 30
var classifier = ee.Classifier.smileRandomForest(100).train(training, 'nd'); //set the number of trees in random forest to 100
var classified = input.classify(classifier);
Map.addLayer(classified, {
  min: 0,
  max: 1
}, 'classified image');


  • 1
    Welcome to GIS SE. As a new user, please take the Tour. Coding questions are expected to contain a relevant code fragment which reproduces the problem. A link to another site is not sufficient.
    – Vince
    May 14, 2020 at 11:44

1 Answer 1


You have specified a non-existing classProperty in train(). Update it to class, and your code works.

var classifier = ee.Classifier.smileRandomForest(100).train(training, 'class'); //set 


  • Thank's very much for the help! Carla. May 14, 2020 at 17:23

Your Answer

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

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