问题描述
我正在尝试在德里位置使用Forest算法对Landsat8图像(LANDSAT / LC08 / C01 / T1)进行监督分类,并且需要在城市边界上应用不同的元素。 这是我的代码:
var landsatCollection = ee.ImageCollection('LANDSAT/LC08/C01/T1')
.filterBounds(roi)
.filterDate('2020-03-01','2020-08-31')
.sort('CLOUD_COVER');
var composite = ee.Algorithms.Landsat.simpleComposite({
collection: landsatCollection,asFloat: true
});
Map.addLayer(composite,{bands: ['B4','B3','B2'],max: 0.5,gamma: 2},'L8 Image',false);
var newfc = urban.merge(water).merge(others);
print(newfc,'newfc')
//tried clipping the image but not working.
var boundary = composite.clip(box);
Map.addLayer(boundary,min:0,max:3000},'Clip');
var bands = ['B2','B4','B5','B6','B7'];
var training = composite.select(bands).sampleRegions({
collection: newfc,properties: ['landcover'],scale: 30
});
var classifier = ee.Classifier.randomForest().train({
features: training,classProperty: 'landcover',inputProperties: bands
});
var classified = composite.select(bands).classify(classifier);
var palette = [
'D3D3D3','0000FF','008000'
];
Map.setCenter(-96.0171,29.6803);
Map.addLayer(classified,{min: 0,max: 2,palette: palette},'Land Use Classification');
print('RF error matrix: ',classifier.confusionMatrix());
print('RF accuracy: ',classifier.confusionMatrix().accuracy());```
I have taken three classes urban,water and others but need help in clipping the image and in covering the city boundary(polygon) of the selected roi for further processing?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)