land use classification

map urban areas

Step 1: add your composite to the map


Step 2: create training sample for urban


Step 3: add training samples


Step 4: create feature collection for non-urban


step 5: add points for non-urban


Step 6: merge the data points

// merge data
var trainingData = urban.merge(other);

Step 7:  set the prediction bands

// set the selection bands
var predictionBands = image.bandNames();

Step 8: create a training sample

// sample the regions
var classifierTraining ={collection: trainingData, properties: ['land_class'], scale: 30 });

Step 9: train the classifier

// train the classifier
var classifier = ee.Classifier.randomForest(10).train({features:classifierTraining, classProperty:'land_class', inputProperties: predictionBands});

Step 10: Classify the image

// get the classified image
var classified =;

Step 11: add the classified image to the map


Step 12: Change the classifier to probablity

// train the classifier
var classifier = ee.Classifier.randomForest(100).setOutputMode('PROBABILITY').train({features:classifierTraining, classProperty:'land_class', inputProperties: predictionBands});

One comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s