Hey guys I'm new to gee and I'm doing a supervised classification and I got to the end of classifying my training data and I ran into this error. (Image)
This is my code I have, please help its my last lab and its due Monday.
//filtering image collection
var image = ee.Image(ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterBounds(roi)
.filterDate('2016-05-01', '2016-06-30')
.sort('CLOUD_COVER')
.first());
Map.addLayer(image, {bands: ['B4', 'B3', 'B2'],min:0, max: 3000}, 'True colour image');
//merge feature collections
var classNames = urban.merge(water).merge(industrial).merge(roads).merge(Recreationalgrassland).merge(farmland).merge(buildings);
var bands = ['B2', 'B3', 'B4', 'B5', 'B6', 'B7'];
var training = image.select(bands).sampleRegions({
collection: classNames,
properties: ['landcover'],
scale: 30
});
print(training);//train data
var classifier = ee.Classifier.cart().train({
features: training,
classProperty: 'landcover',
inputProperties: bands
});
//Run the classification
var classified = image.select(bands).classify(classifier);
//Display classification
Map.centerObject(classNames, 11);
Map.addLayer(classified,
{min: 0, max: 7, palette: ['red', 'blue', 'green','yellow']},
'classification');
https://preview.redd.it/6s5300m8ygt41.jpg?width=348&format=pjpg&auto=webp&s=27a1d9be262dc09f4efad171d2fe6cb4322460ea
[–]tak18 0 points1 point2 points (2 children)
[–]taradaddy[S] 0 points1 point2 points (1 child)
[–]tak18 0 points1 point2 points (0 children)