I am trying to get a number of the sum of all pixels in google earth engine, this is what I tried
var PopulationCount = ee.ImageCollection("CIESIN/GPWv411/GPW_Population_Count");
function filterbyyear(image, year) {
return image.date().get('year').eq(year);
}
var year = 2020;
var pop = PopulationCount.filter(ee.Filter.calendarRange(year, year, 'year')).first();
function SumAllPixels(image) {
var sum = image.reduceRegion({
reducer: ee.Reducer.sum(),
geometry: image.geometry(),
scale: 30,
maxPixels: 1e9
});
return sum;
}
var sum = SumAllPixels(pop);
print(sum);
But I get the following error:
Dictionary (Error) Image.reduceRegion: Provide 'geometry' parameter when aggregating over an unbounded image.
It seems that it wants me to crop the image to a smaller unit, but I am not sure