2

I am trying to export a GeoTIFF from GEE to my drive and I have gotten this error messege: Error: Image.clipToBoundsAndScale, argument 'input': Invalid type. Expected type: Image<unknown bands>. Actual type: ImageCollection.

This is my code:

// defining Thailand polygon----
var thailand = ee.Geometry.Polygon(
         [[[97.3113107563326, 20.46454530076102],
           [97.3113107563326, 5.601181272588201],
           [105.6389474750826, 5.601181272588201],
           [105.6389474750826, 20.46454530076102]]], null, false);

// loading GPM: Monthly Global Precipitation Measurement (GPM) v6----
var gpm = ee.ImageCollection('NASA/GPM_L3/IMERG_MONTHLY_V06');

// Thailand precipitation since 2019-04-01 to 2020-04-01----
var preci_th = gpm
          .select('precipitation')
          .filterBounds(thailand)
          .filterDate('2019-04-01','2020-05-01');
print(preci_th);

// exporting precipitation of Thailand Geotiff image----
Export.image.toDrive({
  image:preci_th,
  description: 'TH-MonthlyPreci_2019-04_2020-04',
  folder: 'G:/My Drive/Google earth engine',
  fileFormat: 'GeoTIFF'
});

How should I do it?

1 Answer 1

1

The Export.image.toDrive function takes an image but preci_th is an image collection, with an image per month of the year (starting with April).

You could either select an image from the collection and export it this way, or import a custom function to export the whole collection.

By selecting an image:

// select the first image (April) from collection
var preci_th_APR = preci_th.first()

// export precipitation of Thailand Geotiff image----
Export.image.toDrive({
  image:preci_th_APR,
  description: 'TH-MonthlyPreci_2019-04_2020-04',
  folder: 'G:/My Drive/Google earth engine',
  fileFormat: 'GeoTIFF'
});

Or export the collection (all months):

// import the batch export function
var batch = require('users/fitoprincipe/geetools:batch')

// export precipitation of Thailand **image collection**
batch.Download.ImageCollection.toDrive(preci_th, 'Folder', 
                {scale: 1000,  // adjust to desired pixel resolution
                 region: thailand, 
                 type: 'float'})

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.