0

I am new to GEE and have tried to understand my issue by looking through the existing questions related to exporting images to Drive. Unfortunately, I cannot seem to address my issue and hope that someone may be able to help me.

The problem: the file that is exported to Drive is only 1GB, so there is something going wrong (the file should be much bigger!)

My goal: export the composite image for my study area to GEE, so that I can then open it in Idrisi or ArcMap. I believe that the study area is so large (2million square hectares) that when I export it, it should be exported as multiple tiles in geotiff format. however, I do not know what I am doing wrong in my export code because the output in drive is just a single, 1GB file.

The code I am using looks as follows:

// Define a region of interest  (i.e. the shapefile you imported)
var roi = K2C_aoi;

// Load the Landsat 8 scaled radiance image collection.
var landsat2013 = ee.ImageCollection('LANDSAT/LC08/C01/T1')
    .filterDate('2013-05-01', '2013-07-31')
    .filterBounds(roi);
print(landsat2013);


// Make a cloud-free composite.
var composite = ee.Algorithms.Landsat.simpleComposite({
  collection: landsat2013,
  asFloat: true
});

// Clip composite to aoi... 'clipped_composite' is the image you ultimately want to export
var clipped_composite2013 = composite.clip(roi);

//visualize the clipped composite
//Map.addLayer(clipped_composite2013, {bands: ['B4', 'B3', 'B2'], max: 0.5, gamma: 2}, 'Natural color', true);
Map.addLayer(clipped_composite2013, {bands: ['B5', 'B4', 'B3'], max: 0.5, gamma: 2}, 'Color infrared', true);
Map.centerObject(K2C_aoi, 9);

// Select the image and the band combination.
var compositeSelection = ee.Image('clipped_composite2013')
  .select(['B4', 'B3', 'B2']); //natural colors

// Create a geometry representing an export region.
var geometry = K2C_aoi;

// Export the image, specifying scale and region.
Export.image.toDrive({
  image: clipped_composite2013.float(),////////////////////////remove this?
  //image: clipped_composite2013.mosaic(), not a function
  description: 'imageToDriveExample2',
  maxPixels: 3784216672400,/////////////////////////////remove this?
  scale: 30,
  region: K2C_aoi,
  maxPixels: 3784216672400,///////////////how many pixels should I list?
});
2
  • Hi Daniel, sorry that you are unhappy with my question! I didn't realize you needed that information on my area size-- in my script, I just have it as roi, but it is from a shapefile asset that I imported and it covers approximately 2million square hectares, so it is quite large. Based on my reading of other questions in gis.se related to the export, this size area SHOULD be split into multiple geotiffs.
    – rmirvine9
    Commented May 4, 2020 at 14:09
  • When I opened the file it just appeared as a black box, but now that I ran it again it seems to be working. I did not change the script so I do not know why the first output did not open properly? regardless I have the image open in ArcMap now and the 'problem' has been resolved. thank you very much for taking the time to respond to my query.
    – rmirvine9
    Commented May 4, 2020 at 15:18

2 Answers 2

2

What specifically was wrong with the exported image? 1 GB sounds like a reasonable size for your 2 million square hectares, as far as I can tell.

var areaHa = 2 * 1e6
var areaM2 = areaHa * 1e4
var scale = 30 // 30 m Landsat
var pixelCount = areaM2 / (scale * scale)
var layerCount = 12 // Exporting 12 bands
var bitsPerLayer = 32 // Image cast to float before exporting
var bytesPerLayer = bitsPerLayer / 8
var bytesPerPixel = layerCount * bytesPerLayer
var imageBytes = pixelCount * bytesPerPixel
var imageGb = imageBytes / 1e9

print('Image Gb', imageGb)

https://code.earthengine.google.com/bd871130dd61aa0d695cb65ff48825ad

1
  • the image is ok now that I ran it again! I did not change the script, but now the image opens as it should (before it was just a black expanse). thank you
    – rmirvine9
    Commented May 4, 2020 at 15:19
0

I could be wrong, but I experienced a similar problem and it was solved after changing the way I clip my study area. Not sure why. Try this in your export code:

Export.image.toDrive({
      image: clipped_composite2013.clip(K2C_aoi).toFloat(),
      description: 'imageToDriveExample2',
      scale: 30,
      fileFormat: 'GeoTIFF',
    });

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.