geetools icon indicating copy to clipboard operation
geetools copied to clipboard

Error when trying to batch export VIIRS images to Google Drive

Open nikosGeography opened this issue 3 years ago • 0 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 Landsat 8 imagery and filter it  
var collection = ee.ImageCollection('NOAA/VIIRS/DNB/MONTHLY_V1/VCMCFG')
  .filter(ee.Filter.date('2013-05-01', '2021-12-31'))
  .filterBounds(table)
  .select('avg_rad')
  .first()
  .clip(table);
  
var count = collection.size()
print("Collection", count)

// export collection to google drive
batch.Download.ImageCollection.toDrive(
  collection, 
 'Folder', 
  {name: 'ntl_{system:index}',
  crs: 'EPSG: 27700',
  type: 'float',
  scale: 460,
  region: table});

The table is a polygon shp that I am using to clip the area of interest. The same error occurs even if I specify a bounding box using ee.Geometry. Here is a link to the GEE project

nikosGeography avatar Sep 18 '22 14:09 nikosGeography