I have performed a supervisioned classification to identify lakes in a study region.
How can I transform a classification that are in Image to ShapeFile?
The code that I wrote:
var image = ee.Algorithms.Landsat.simpleComposite({
collection: l8.filterDate('2015-01-01', '2019-12-31'),
asFloat: true
});
var image = image.clip(geometry);
// Use these bands for prediction.
var bands = ['B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B10', 'B11'];
// Manually created polygons.
// Make a FeatureCollection from the hand-made geometries.
var polygons = ee.FeatureCollection([
ee.Feature(nonlake, {'class': 0}),
ee.Feature(nonlake1, {'class': 0}),
ee.Feature(lake1, {'class': 1}),
ee.Feature(lake2, {'class': 1}),
ee.Feature(lake3, {'class': 1})
]);
// Get the values for all pixels in each polygon in the training.
var training = image.sampleRegions({
// Get the sample from the polygons FeatureCollection.
collection: polygons,
// Keep this list of properties from the polygons.
properties: ['class'],
// Set the scale to get Landsat pixels in the polygons.
scale: 30
});
// Create an SVM classifier with custom parameters.
var classifier = ee.Classifier.libsvm({
kernelType: 'RBF',
gamma: 0.5,
cost: 10
});
// Train the classifier.
var trained = classifier.train(training, 'class', bands);
// Classify the image.
var classified = image.classify(trained);
//Map.addLayer(polygons, {}, 'training polygons');
Map.addLayer(classified, {min: 0, max: 1, palette: ['white', 'black']},
'delakeation');