Export VIIRS nighttime image from Google Earth Engine

exportgoogle-earth-engine

I clipped Nighttime image VIIRS-DNB according to my area of interest from Google Earth Engine. But I am unable to export it because of showing error.

Error: Image.clipToBoundsAndScale, argument 'input': Invalid type. 
Expected type: Image. Actual type: ImageCollection. (Error code: 3).

What do I have to do?

var table2 = ee.FeatureCollection("projects/tensile-axiom-380702/assets/bangladeshh"),
    imageCollection = ee.ImageCollection("NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG");
Map.addLayer(table2)

var dataset = ee.ImageCollection('NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG')
                  .filter(ee.Filter.date('2018-12-01', '2018-12-31'))
                  .filterBounds(table2);
    
function clp(img)   {
  return img.clip(table2)
}

var clippedVIIRS = dataset.map(clp)
var nighttime = clippedVIIRS.select('avg_rad');
Map.addLayer(nighttime.median());

Export.image.toDrive({
  image: nighttime,
  description: 'banlll',
  fileFormat: 'GeoTIFF',
  region: table2,
  scale: 750,
  maxPixels: 1e8
  
})

Best Answer

nighttime is an ImageCollection even if it contains a single image. The error states that clearly.

To get that one image, use nighttime.first().

Export.image.toDrive({
  image: nighttime.first(),
  ...

enter image description here

Related Question