1

I have been working on a supervised classification and am now trying to place random points to do an accuracy assessment. To do this I am needing to convert each class in my classification to its own geometry as I want to place a certain amount of training points in each class. I have not been able to successfully convert the classification regions into geometries yet, but I assume it is a simple fix. I thought it could be done with image.geometry(), but it made a geometry over the entire world instead of just a single class.

var improved = classified_svm.updateMask(mask_improved);
Map.addLayer(improved, {}, "improved");
var improved_clip = improved.clip(bir);
var improved_geo = improved_clip.geometry(); <--- This is where it goes wrong

Link to code: https://code.earthengine.google.com/5005a440fa695d5aa286e226f8f26ff5

Link to bir asset: https://code.earthengine.google.com/?asset=users/anna_odell/bir_Boundary2005

Link to points asset: https://code.earthengine.google.com/?asset=users/anna_odell/trainingpoints3

0

Do not try to create separate geometries for each class. Instead used .strafiedSample

var sample = classified_svm.stratifiedSample({
  numPoints: 100,
  classBand: 'classification',
  region: bir,
  seed:1,
  scale:1,
  classValues: [0, 1, 2, 4],
  classPoints: [10,10,40,40],
  geometries: true
});

classPoints specifies how many points you want in each class defined in classValues

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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