I want to export an NDVI map for the Quebec province, Canada, from GEE so that I can select my sampling locations after importing the map on QGIS. But I get this error:
Error: Export too large: specified 8030040147504 pixels (max: 1000). Specify higher maxPixels value if you intend to export a large area. (Error code: 3)
I tried to look at videos on YouTube and read answers to similar questions on StackExchange, but the examples are for one type of Landsat and not for a mix of two Landsats.
Can you help me with modifying the code?
Here is the link to the script: https://code.earthengine.google.com/0ca4247b9b45abbece8491289b65a878
Here is the code:
var S2 = ee.ImageCollection("LANDSAT/LT05/C02/T1_L2")
var S9 = ee.ImageCollection("LANDSAT/LC08/C02/T1_L2")
// to add Geometry
var addNDVI = function(image) {
var ndvi = image
.clip(geometry)
.normalizedDifference(['SR_B4', 'SR_B3'])
.rename('NDVI');
return image.addBands(ndvi);
};
var addNDVI2 = function(image) {
var ndvi = image
.normalizedDifference(['SR_B5', 'SR_B4'])
.rename('NDVI');
return image.addBands(ndvi);
};
// Filter par date et calculer la mosaique
var withNDVI = S2.map(addNDVI).filterDate('1988-06-15', '2012-08-30').qualityMosaic('NDVI').select('NDVI');
var withNDVI_2 = S9.map(addNDVI2).filterDate('2013-06-15', '2022-08-30').qualityMosaic('NDVI').select('NDVI');
var NDVI_diff = withNDVI_2.subtract(withNDVI)
var ndviParams = {min: -1.5, max: 1.5, palette: ['black', 'white', 'green']};
//visualiser sur la carte
Map.centerObject(geometry)
Map.addLayer(NDVI_diff, ndviParams, 'NDVI image');
// Exporter l'image vers Drive.
Export.image.toDrive({
image: withNDVI,
description: 'NDVI-1985',
scale: 10,
fileFormat: 'GeoTIFF',
formatOptions: {
cloudOptimized: true
},
maxPixels: 1e13
});