I want to export clip image with the population data. But when I run the export file in the TASK menu, I get this error:
Error: Image.clipToBoundsAndScale, argument 'input': Invalid type. Expected type: Image. Actual type: ImageCollection. (Error code: 3)
Images are not exported. Can you help me about this issue?
var shp = ee.FeatureCollection(antalya)
Map.centerObject(antalya);
Map.addLayer(shp,{},'bolge')
var dataset = ee.ImageCollection('JRC/GHSL/P2016/POP_GPW_GLOBE_V1')
.filterBounds(antalya)
.filter(ee.Filter.date('2015-01-01', '2015-12-31'))
;
var antalyanufus = dataset.map(function(img){return img.clip(antalya)})
var populationCount = dataset.select('population_count');
var populationCountVis = {
min: 0.0,
max: 200.0,
palette: ['060606', '337663', '337663', 'ffffff'],
};
Map.addLayer(populationCount, populationCountVis, 'Population Count');
var antalyanufusVis = {
min: 0.0,
max: 200.0,
palette: ['060606', '337663', '337663', 'ffffff'],
};
var antalyanufusVisrenkli = {
min: 0.0,
max: 200.0,
palette: ['ffffe4','5a76ff','0c13ff','001189'],
};
Map.addLayer(antalyanufus,antalyanufusVisrenkli,'Antalya nufus');
var panel = ui.Panel({
style: {
position: 'bottom-left',
padding: '5px;'
}
})
var title = ui.Label({
value: 'Nufüs Yoğunluğu',
style: {
fontSize: '14px',
fontWeight: 'bold',
margin: '0px;'
}
})
panel.add(title)
var color = ["ffffe4","5a76ff","0c13ff","001189"]
var lc_class = ['seyrek','az yoğun','yoğun','Çok yoğun']
var list_legend = function(color, description) {
var c = ui.Label({
style: {
backgroundColor: color,
padding: '10px',
margin: '4px'
}
})
var ds = ui.Label({
value: description,
style: {
margin: '5px'
}
})
return ui.Panel({
widgets: [c, ds],
layout: ui.Panel.Layout.Flow('horizontal')
})
}
for(var a = 0; a < 4; a++){
panel.add(list_legend(color[a], lc_class[a]))
}
Map.add(panel)
// Export to GDrive
Export.image.toDrive({
image: dataset.select('antalyanufus'),
description: 'nufus',
scale: 100,
region: antalya
})