Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ee.Image(image.updateMask(mask)).divide(10000).addBands(qa, null, true)
- .copyProperties(image).set("system:time_start", image.get("system:time_start"));
- // bands to use the classification for
- var bands = S2.first().bandNames().slice(1,12);
- // Think about which image you want to use as input for the classifier:
- // Do you have one 'perfect' image? Or do you want to classify based on every single image?
- // map over the image collection, do the classification per-image
- var classified = S2.map(function(image){
- var training = image.select(bands).sampleRegions({ collection: newfc, properties: ['id'], scale: 30 }); // print(training)
- var classifier = ee.Classifier.cart().train({ features: training, classProperty: 'id'});
- var classImage = image.select(bands).classify(classifier).rename('classified');
- return image.addBands(classImage);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement