I am trying to take an image at a native resolution scale of 250m and reproject it to 5000m and sum the values in the smaller pixels to the larger one.
I can do this in Earth Engine with the following, but it's just re-sampling the data (I'm guessing it's just calculating an average value):
var imageForAnalysis = ee.Image('JRC/GHSL/P2016/POP_GPW_GLOBE_V1/2015');
var proj = imageForAnalysis.projection();
var reprojectedImage = imageForAnalysis
.reduceResolution({
reducer: ee.Reducer.sum(),
maxPixels: 1024
})
.reproject({
crs: proj,
scale:5000
});
I've tried changing the reducer
to ee.Reducer.sum()
, but it does not yield a total value for the larger pixel size.
Any ideas?