I'm trying to export Sentinel 2 images over a region of interest from 2010 to 2020 and I require every image and not just the median.
I've tried using the following code :
var dataset = ee.ImageCollection("COPERNICUS/S2_HARMONIZED")
.filterBounds(roi)
.filter(ee.Filter.lessThan('CLOUD_COVERAGE_ASSESSMENT', 20))
.filterDate('2010-01-01', '2020-12-31'); // Keep all images within the date range
var rescale = dataset.map(function(image) { return image.divide(10000); }); // Apply scaling to each image
var clippedCollection = rescale.map(function(image) { return image.clip(roi); }); // Clip each image to ROI
Export.imageCollection.toDrive({
collection: clippedCollection,
description: 'sentinel_2010_2020',
scale: 10,
folder: 'your_folder_name', // Optional: Specify a folder within your drive
maxImages: 1000 // Optional: Limit the number of exported images (if applicable)
});
but it's throwing an error -
Line 12: Cannot read property 'toDrive' of undefined"
Any solutions to this?
Export.imageCollection.toDrive
function, you can only export images withExport.image.toDrive
. However, there is a third party batch script you can import with this functionality, try this answer on stackoverflow.