I run an unsupervised classification with Google Earth Engine using this code:
// UNSUPERVISED classification of Conifers//
var input = ee.ImageCollection("COPERNICUS/S2_SR");
var geometry =
/* color: #98ff00 */
/* displayProperties: [
{
"type": "rectangle"
}
] */
ee.Geometry.Polygon(
[[[7.582719257752308, 46.02568420992065],
[7.582719257752308, 44.97372238809936],
[9.228269435087903, 44.97372238809936],
[9.228269435087903, 46.02568420992065]]], null, false);
input = input.filterBounds(geometry);
print(input);
input = input.filterDate('2020-08-06','2020-08-08');
print(input);
input = input.sort('CLOUD_COVER');
input = input.mosaic();
print(input);
input = input.clip(geometry);
print(input);
Map.centerObject(geometry,9);
Map.addLayer(input,{min:-157.33,max:1421.15,bands:['B4','B3','B2']}, 'input image');
var training = input.sample({
region: geometry,
scale: 10,
numPixels: 5000
});
var clusterer = ee.Clusterer.wekaKMeans(15).train(training);
var result = input.cluster(clusterer);
Map.addLayer(result.randomVisualizer(), {}, 'Unsupervised Classified Image');
Export.image.toDrive({
image: result,
description: 'Unsupervised Classified Image',
scale: 10,
region: geometry
});
When I run the code with 10m scale in the training part and choose 10m also while exporting, it never finished the export to drive and I got this error:
Error: Export too large: specified 214533809 pixels (max: 100000000). Specify higher maxPixels value if you intend to export a large area.
However, when I set the scale in code and while exporting to 20m, it got exported in 8 minutes. I need the result in 10m resolution so how can I change the code so it exports a 10m resolution? This is my first attempt in GEE and I am not familiar with how the scale and numPixel have to change. Please let me know if I can modify any other part of the code.