0

I am trying to do Random Forest in Google Earth Engine. I generate landslide class and non-landslide class in a region

var landslide = ee.FeatureCollection.randomPoints(Iburi, 500)
var nonlandslide = ee.FeatureCollection.randomPoints(outlandslide, 500)

Then, merge it using

var samples = landslide.merge(nonlandslide)

However, it comes to error when I run the Random Forest

According to the Supervised Classification page in the Google Developers Guide, I have to provide

a property that stores the known class label and properties storing numeric values for the predictors

How do I create a property with numeric values in the samples generated from Random points?

1 Answer 1

1

You map over each collection (before the merge), assigning a class to each feature:

var landslide = ee.FeatureCollection.randomPoints(Iburi, 500)
    .map(function(f) {
        return f.set('class', 1)
    })
1
  • Thank you very much. It's help me a lot Jun 24, 2021 at 17:45

Your Answer

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

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