1
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

  • 2
    the solution seems to be "Specify higher maxPixels value if you intend to export a large area" – Ian Turton Jan 10 '18 at 15:33
  • 1
    Do you really want to export an image with 37,842,166,724,310 pixels into your drive account? maxPixels is there to force you to consider that. Also, you should be using clipToCollection() in this context. – Nicholas Clinton Jan 11 '18 at 0:48
3

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

-2

you should add 10 more pixel and you are good to go

  • 1
    Could you explain why? – BERA Jun 11 '18 at 16:11
  • 1
    Welcome to GIS SE! Please take the Tour to get accustomed i.a. with how to write a good answer; the core of this community being the scientific expertise of the presented solutions to specific problems, an answer can, most of all, not be a one-liner! Use the edit function to add way more detail as to why you believe your proposition might help in solving the issue. – ThingumaBob Jun 11 '18 at 16:15
  • Indeed, 34057950051910 more pixels to maxPixels argument... You should check your maths – aldo_tapia Jun 11 '18 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.