2

Actually, when I'm trying to do a landuse supervised classification with Google Earth Engine, a strange message appears :

Collection.geometry: Unable to perform this geometry operation. Please specify a non-zero error margin. in , line 11 in , line 24

What is wrong with my code?

var image = ee.Image(ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
    .filterBounds(roi)
    .filterDate('2018-05-01', '2018-06-30')
    .sort('CLOUD_COVER')
    .first());
Map.addLayer(image, {bands: ['B4', 'B3', 'B2'],min:0, max: 3000});
var classNames = turban.merge(twater).merge(tforest).merge(tagriculture).merge(tsoil);
print(classNames);
var bands = ['B2', 'B3', 'B4', 'B5', 'B6', 'B7'];
var training = image.select(bands).sampleRegions({
  collection: classNames,
  properties: ['landcover'],
  scale: 30


});

print(training);
var classifier = ee.Classifier.cart().train({
  features: training,
  classProperty: 'landcover',
  inputProperties: bands,
  });
var classified = image.select(bands).classify(classifier);
Map.centerObject(classNames, 11);
Map.addLayer(classified,
{min: 0, max: 4, palette: ['red', 'blue', 'green','yellow','orange']},
'classification');
1
  • Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works.
    – Ian Turton
    Commented May 9, 2020 at 10:49

1 Answer 1

0

i've fixed the problem by reducing the size of the training data

2
  • 1
    It would be useful to also add the limit, above which it fails
    – nmtoken
    Commented May 6, 2020 at 9:43
  • This error message showed to me; I had drawn some ROIs using the free shaped polygon (draw shape) and then I added another rectangular polygon (draw rectangle); the latter had an additional feature, geodesic: false which caught my eye; I dropped that singular polygon, then drew it again as shape and code worked again.
    – Elio Diaz
    Commented Oct 2 at 19:01

Your Answer

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

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