0

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?

1
  • If you read the documentation, you will see there is no Export.imageCollection.toDrive function, you can only export images with Export.image.toDrive. However, there is a third party batch script you can import with this functionality, try this answer on stackoverflow.
    – user2856
    Commented May 16 at 3:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.