I am trying to download Landsat 8 surface reflectance images from Google Earth Engine to Google Drive for a large region. So, I am using mosaic function to stitch multiple scenes using the following code:

var boundary = /* color: #d63000 */ee.Geometry.Polygon(
        [[[78.56506667945794, 26.640039393450746],
          [78.01575027320794, 25.693458091779274],
          [77.88391433570794, 24.239395841240906],
          [78.36731277320794, 23.173132756934805],
          [79.44397292945794, 22.910277202990187],
          [80.23498855445794, 23.616789268102917],
          [80.85022292945794, 24.179275143314744],
          [80.74035964820794, 24.619498810104982],
          [81.26770339820794, 24.779198274777123],
          [81.79504714820794, 25.2371877370204],
          [81.24573074195794, 25.792417620032328],
          [79.75159011695794, 26.502476306664732],
          [78.16955886695794, 26.581104013226085]]]);

var dataset = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
      .filterDate('2018-10-01', '2018-12-31')
      .filterMetadata('CLOUD_COVER', 'less_than',10)
           .map(function(image){return image.clip(boundary)});

// Applies scaling factors.
function applyScaleFactors(image) {
  var qaMask = image.select('QA_PIXEL').bitwiseAnd(parseInt('11111', 2)).eq(0);
  var saturationMask = image.select('QA_RADSAT').eq(0);
  var opticalBands = image.select('SR_B.').multiply(0.0000275).add(-0.2);
  var thermalBands = image.select('ST_B.*').multiply(0.00341802).add(149.0);
  return image.addBands(opticalBands, null, true)
              .addBands(thermalBands, null, true)

dataset = dataset.map(applyScaleFactors).mosaic();

var visualization = {
  bands: ['SR_B5', 'SR_B4', 'SR_B3'],
  min: 0.0,
  max: 0.3,

Map.addLayer(dataset, visualization, 'FCC (543)');

//Export the data
  description: 'Area_L8',
  folder: 'my_folder',
  scale: 30,
  region: boundary,
  crs: 'EPSG:32644', //UTM Zone 44 N
  maxPixels: 1e10,

But it returns the following error:

Error: Exported bands must have compatible data types; found inconsistent types: Float64 and Byte. (Error code: 3)

How can I save the mosaiced and clipped Landsat 8 to Google Drive?


1 Answer 1


If you print your image print(dataset) and inspect the output, you'll notice that different bands have different types. Some are doubles, some are integers. When exporting to Google Drive, all need to be of the same type. Also, there are a number of bands you probably aren't interested in. I'm guessing you only care about SR_B.* and maybe ST_B10. Coincidentally, all these bands are doubles, so if you only exported them, you'd be fine. This selects only these bands:

dataset.select(['SR_B.*', 'ST_B10'])

Alternatively, you can convert the bands to a data type of your choice. Look at float(), double(), uint.*(), int.*(), and byte() on ee.Image in the docs. For instance, you could turn all bands to doubles with this:


Or maybe you only want the double bands, but want the resulting image to take up less space:

  .select(['SR_B.*', 'ST_B10'])

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.