0

i'm trying to export image from GEE to my drive and I have gotten this error messege: Error: Exported bands must have compatible data types; found inconsistent types: Byte and Float64.

I have read here that it may have to do with the bands, but the thing is that I don't really need all the bands, I want to download it in RGB .

this is the code I have :


// Load a Landsat 8 -atmospheric corrected
var collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR') 
//surface reflectance
    .filterBounds(table)
    .filterDate('2015-03-01', '2018-03-31');

// Get the number of images.
var count = collection.size();
print('Count: ', count);


// make a composite (mean image) of the images 
var meanImage = collection.mean().clip(table);
print(meanImage,'mean image');

//make image for mesopotamia only
//var mesopotamia=meanImage.clip(table);

//visualization
var visParams = {
  bands: ['B4', 'B3', 'B2'],
  min: 0,
  max: 3000,
  gamma: 1.4,
};

Map.addLayer(meanImage,visParams,'Landset8');
//Map.addLayer(mesopotamia,visParams,'Mesopotamia');


var toexport = meanImage.visualize(visParams).addBands(meanImage)

  // Export the image, specifying scale and region.
Export.image.toDrive({
  image: toexport,
  description: 'MesopotamiaLandset8',
  scale:30,
  maxPixels:201406799,
  region: table
});
1

1 Answer 1

1

This line may be causing the error

var toexport = meanImage.visualize(visParams).addBands(meanImage)

The .visualize(visParams) will give you an RGB image that can be easily displayed. It will be formatted to 8 bit (i.e. the radiometric resolution of essentially all screens, monitors, etc.).

However the .addBands(meanImage) method then appends all the bands in meanImage, which should be int16 (Landsat 8 radiometric resolution).

It is not clear why you got a Byte and Float64 error message (I did not) but the following should work..

var toexport = meanImage.visualize(visParams)

Your Answer

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

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