Stratified random sampling with Google Earth Engine Error
Try using just the stratifiedSample algorithm: https://code.earthengine.google.com/e061f92736d8261f812db1dc2bfa8934
var ROI = ee.Geometry.Rectangle(-82.56277, 35.58935,-82.53436, 35.59996); // define area
var features = ee.FeatureCollection([
ee.Feature(ee.Geometry.Rectangle(-82.56123, 35.59053,-82.55213, 35.59674),{class: 0}),
ee.Feature(ee.Geometry.Rectangle(-82.54245, 35.591453, -82.537172, 35.596496),{class:1})
])
var classes = ee.Image().byte().paint(features, "class").rename("class")
Map.centerObject(ROI);
Map.addLayer(classes,{min:0,max:1,palette: ['grey','white']});
var stratified = classes.addBands(ee.Image.pixelLonLat())
.stratifiedSample({
numPoints: 1000,
classBand: 'class',
projection: 'EPSG:3665',
scale: 10,
region: features.geometry()
}).map(function(f) {
return f.setGeometry(ee.Geometry.Point([f.get('longitude'), f.get('latitude')]))
})
print (stratified.reduceColumns(ee.Reducer.frequencyHistogram(),['class']));
Map.addLayer(stratified);