I am trying to download (export) WorldPop data (population count at 100m spatial resolution) for 2018 for the city of London, using Google Earth Engine
(GEE
). The WorldPop is a yearly dataset.
There is no example available so I tried this (among other things):
var dataset = ee.ImageCollection("WorldPop/GP/100m/pop")
.filter(ee.Filter.date('2018-01-01', '2018-12-31'));
var bands = 'population'
var visualization = {
bands: ['population'],
palette: ['24126c', '1fff4f', 'd4ff50']
};
Map.addLayer(dataset, visualization, 'Population');
Export.image.toDrive({
image: dataset,
description: 'pop',
scale: 100,
region: table,
maxPixels: 1000000000000,
crs: 'EPSG:27700',
folder: 'Landsat-5'
});
but I am getting this error:
Error: Image.setDefaultProjection, argument 'image': Invalid type. Expected type: Image<unknown bands>. Actual type: ImageCollection. (Error code: 3)
which means I am trying to export the entire image collection (I don't want that). How can I export the population of London for the year 2018?
Here is the link to my code and here is the link to the asset.
Best Answer
You need to select the image from the collection. What I do here is use the table to filter the collection spatially. Then I convert the image collection to an image list, and finally, I extract the image from the list to export it.