geetools-code-editor icon indicating copy to clipboard operation
geetools-code-editor copied to clipboard

Error when using trying to batch export VIIRS images to Google Drive

Open nikosGeography opened this issue 2 years ago • 1 comments

Hi, I was trying to use batch.ImageCollection.toDrive and I received the error:

In users/fitoprincipe/geetools:batch
Line 133: collection.size is not a function

Here is my code:

var batch = require('users/fitoprincipe/geetools:batch')
// Load the VIIRS ImageCollection.
var dataset = ee.ImageCollection('NOAA/VIIRS/DNB/MONTHLY_V1/VCMCFG')
.filterBounds(table)
.select('avg_rad')
.first()
.clip(table);
batch.Download.ImageCollection.toDrive(dataset, 'Folder',
{scale: 460,
region: (table),
type: 'float'})

The table is a shp that I use to clip the ImageCollention. The same error appears when using a bounding box. I created a folder called Folder in my Google Drive. Here is the link to the GEE project.

nikosGeography avatar Sep 18 '22 13:09 nikosGeography

@nikosGeography I think the issue is you are trying to export an image, not an image collection. When you use .first(), it selects the first image of the collection, and extracts it from the collection. collection.size only works on collections, not on images, which I believe is why you are getting this error.

acwatt avatar Nov 07 '23 15:11 acwatt