0

I'm quite new to Google Earth Engine and I think my issue might be quite easily resolved, but I've made these two codes as I'm having issues with each of them. I'm trying to export the landsat imagery, either the entire file or a subset within the bounds of roi. Here was my first attempt:

var roi = 
    /* color: #d63000 */
    /* shown: false */
    /* displayProperties: [
      {
        "type": "rectangle"
      }
    ] */
    ee.Geometry.Polygon(
        [[[-121.8802978515625, 44.437465346193136],
          [-121.8802978515625, 43.72323520263136],
          [-120.68828125, 43.72323520263136],
          [-120.68828125, 44.437465346193136]]], null, false),
    landsat = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR");

// Filter Down the imagery
var imagery = landsat.filterDate('2016-04-30', '2016-05-02').filterBounds(roi)
  .sort('CLOUD_COVER', false);

//View the imagery
var visParams = {bands: ['B4', 'B3', 'B2'], min: 0, gamma: 1.4};
Map.addLayer(imagery, visParams, 'Bend Landsat');
Map.setCenter(-121.29, 44.0945, 13);

// Export the image, specifying scale and region.
Export.image.toDrive({
  image: imagery.select('B10','B11'),
  description: 'imageToDriveExample',
  scale: 30,
  region: roi,
  maxPixels:1e11
});

I just get an error. This is my error: Error: Image.clipToBoundsAndScale, argument 'input': Invalid type. Expected: Image. Actual: ImageCollection. How can I get this right?

This was my second technique. It works, but it does this weird thing where it exports the imagery as 4 separate files. I can mosaic them together, but they don't exactly look the same.

var roi = 
    /* color: #d63000 */
    /* shown: false */
    /* displayProperties: [
      {
        "type": "rectangle"
      }
    ] */
    ee.Geometry.Polygon(
        [[[-121.8802978515625, 44.437465346193136],
          [-121.8802978515625, 43.72323520263136],
          [-120.68828125, 43.72323520263136],
          [-120.68828125, 44.437465346193136]]], null, false),
    landsat = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR");

var batch = require('users/fitoprincipe/geetools:batch');

// Filter Down the imagery
var imagery = landsat.filterDate('2016-04-30', '2016-05-02').filterBounds(roi)
  .sort('CLOUD_COVER', false);

//View the imagery
var visParams = {bands: ['B4', 'B3', 'B2'], min: 0, gamma: 1.4};
Map.addLayer(imagery, visParams, 'Bend Landsat');
Map.setCenter(-121.29, 44.0945, 13);

// Download imagery
batch.Download.ImageCollection.toDrive(imagery, 'Folder',
  {scale:15, region:roi.getInfo()[[[-121.8802978515625,43.72323520263136],[-120.68828125,43.72323520263136],[-120.68828125,44.437465346193136],[-121.8802978515625,44.437465346193136]]], type:'float'});

Is there any way for me to get it to my drive as one file? Thanks so much

  • 1
    Please edit your question to include the complete error messages. – Kevin Reid Mar 18 at 22:47
  • Thanks, I have just updated it. Would you happen to know what I'm doing wrong? – Burnz Mar 19 at 14:35
0
var imagery = landsat.filterDate('2016-04-30', '2016-05-02').filterBounds(roi)
  .sort('CLOUD_COVER', false);
...
Export.image.toDrive({
  image: imagery.select('B10','B11'),
  ...
});

Export.image is strictly for exporting a single image, but you have given it an ImageCollection.

In order to get a single image that is identical to what Map.addLayer shows you, use .mosaic() (which Map.addLayer does automatically if given a collection, but Export.image doesn't):

Export.image.toDrive({
  image: imagery.select('B10','B11').mosaic(),
  ...
});
| improve this answer | |

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.