I've created an EE image object with a bunch of bands that lacks any projection information (per the GEE documentation: In particular, note that images produced by reducing an ImageCollection have no projection. This means that you should explicitly set the scale on any computations involving computed images output by an ImageCollection reduction.). I want to aggregate (that is, use a mean reducer in GEE lingo) my data to a standard, moderate resolution--say, 1km. But since .reduceResolution
only accepts images that already have a projection, I find myself in the awkward position of having to force reproject to a smallish resolution, then use .reduceResolution(mean)
, then force reproject again to my desired size...all before having to set the scale again when I go to export the image.
Surely I am making this more complicated than it needs to be. Is there a way to set the export parameters such that it uses .reduceResolution(mean)
when the data is exported?
Here's some simplified code to illustrate my problem:
var AllData = LandsatComposite.addBands(Temp)
.addBands(Elevation).toFloat()
.reproject({crs: 'EPSG:32620', scale: 30})
.reduceResolution({reducer: ee.Reducer.mean()})
.reproject({crs: 'EPSG:32620', scale: 100});
Export.image.toDrive({
image: AllData.select('B1', 'B2', 'B3', 'Temp', 'Elevation').updateMask(mask),
description: "AllData",
region: ROI,
scale: 100,
fileFormat: 'GeoTIFF',
crs: 'EPSG:32620',
maxPixels:1e13
});