geetools-code-editor
geetools-code-editor copied to clipboard
Error when using trying to batch export VIIRS images to Google Drive
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 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.