Below is my code and it runs perfectly but when I run the unsubmitted task in gee,it gives this error:
Error: Image.setDefaultProjection, argument 'image': Invalid type. Expected type: Image. Actual type: ImageCollection. (Error code: 3)
var dataset = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
.filterBounds(geometry)
.filterDate('2019-11-17', '2020-03-31')
// Applies scaling factors.
function applyScaleFactors(image) {
var qaMask = image.select('QA_PIXEL').bitwiseAnd(parseInt('11111', 2)).eq(0);
var saturationMask = image.select('QA_RADSAT').eq(0);
var opticalBands = image.select('SR_B.').multiply(0.0000275).add(-0.2);
var thermalBands = image.select('ST_B.*').multiply(0.00341802).add(149.0);
return image.addBands(opticalBands, null, true)
.addBands(thermalBands, null, true)
.updateMask(qaMask)
.updateMask(saturationMask);
}
dataset = dataset.map(applyScaleFactors);
var visualization = {
bands: ['SR_B4', 'SR_B3', 'SR_B2'],
min: 0.0,
max: 0.3,
};
Map.addLayer(dataset, visualization, 'True Color (432)');
Export.image.toDrive({
image: dataset,
description: 'Landsat8_for_NDBI',
scale: 10,
maxPixels: 1e13,
region: geometry
});
Can you help me to bypass this?
dataset
is not an image but an image collection. You cannot pass an ImageCollection toimage
parameter oftoDrive
function.