[GIS] Export a large image from Google earth engine platform

google-earth-engine

var aoi = ee.FeatureCollection('users/vguyir/NewBegoro');
Map.addLayer(aoi)

var Begoro = aoi.filter(ee.Filter.eq('FID', 0));
var image = ee.ImageCollection('COPERNICUS/S2')
         .filterBounds(geometry)
         .filterDate('2017-01-01', '2017-12-31')
         .sort('CLOUDY_PIXEL_PERCENTAGE')
        ;
//Map.addLayer(image, {bands: ['B4', 'B3','B2'], min:0 ,max: 3000}, 'L1');

var Sort = image.toList(20)
Map.addLayer(ee.Image(Sort.get(1)), {band: ['B1', 'B2','B3'], min:0, max: 0.3},'Landsat 1')

//Map.addLayer(geometry, {}, 'Geometry');

var clip = ee.Image(Sort.get(1)).clip(table2);
Map.addLayer(clip, {band: ['B1', 'B2','B3'], min:0, max:3000}, 'clip');

var image2 = ee.ImageCollection('COPERNICUS/S2')
         .filterBounds(geometry2)
         .filterDate('2017-01-01', '2017-12-31')
         .sort('CLOUDY_PIXEL_PERCENTAGE')
        ;
//Map.addLayer(image, {bands: ['B4', 'B3','B2'], min:0 ,max: 3000}, 'L1');

var Sort2 = image2.toList(20)
Map.addLayer(ee.Image(Sort2.get(1)), {band: ['B1', 'B2','B3'], min:0, max: 0.3},'Landsat 1')

var clip = ee.Image(Sort2.get(3)).clip(table2);
Map.addLayer(clip, {band: ['B1', 'B2','B3'], min:0, max:3000}, 'clip');

var mosaic = ee.ImageCollection([ee.Image(Sort.get(1)),ee.Image(Sort2.get(1))]).mosaic();
Map.addLayer(mosaic, {bands: ['B4','B3', 'B2'], min:0 ,max:3000}, 'mosaic');

Export.image.toDrive({
  image: mosaic.clip(aoi).select('B8', 'B4', 'B3', 'B2'),
  description: 'imageToDriveExample',
  scale: 10,
  region: mosaic.clip(aoi),
  folder : 'Tank',
  maxPixels: 3784216672400,
  crs : 'EPSG:32630'
});

I keep getting this error message:

Export too large: specified 37842166724310 pixels (max:
3784216672400). Specify higher maxPixels value if you intend to export
a large area

Best Answer

In the function:

Export.image.toDrive({
  image: mosaic.clip(aoi).select('B8', 'B4', 'B3', 'B2'),
  description: 'imageToDriveExample',
  scale: 10,
  region: mosaic.clip(aoi),
  folder : 'Tank',
  maxPixels: 3784216672400,
  crs : 'EPSG:32630'
});

'maxPixels' is the largest size dataset that you are able to export (in pixels). Your image is 10 pixels larger than this. If you set maxPixels to 37842166724310 or greater then it will export.

However, be warned, that is a lot of pixels to export into your drive, especially if it is a multi-band image

Related Question