I have three images in GEE ,I would like to reproject two of them to have the dame reprojection as the third one.
each of those 3 images is mosaic of all the avilable tiles from certain day.
The problem is that when I try to reproject the two images I get error:
Image (Error) Image.reduceResolution: The input to reduceResolution does not have a valid default projection. Use reproject() first to set the base projection.
The thing is that I do reproject the images before. I have tried it in two different ways but still get the same error:
try 1:
//Reproject
//Get information about the projection.
//there are two images with this projection
var projection1 = img_one.projection();
print('PROJECTION Image 1:', projection1);
//the projection I want to reproject to
var projection2 = image_two.projection();
print('I want my previous images to have this projection:', projection2);
// // //resampling images to "projection 2"
var prj_one=img_vv.reproject({crs: projection2});
var prj_one=img_vv.reduceResolution({reducer: ee.Reducer.mean()});
var prj_three=img_vh.reproject({crs: projection2});
var prj_three=img_vh.reduceResolution({reducer: ee.Reducer.mean()});
try 2 (less lines):
var prj_one=img_vv.reduceResolution({reducer: ee.Reducer.mean()}).reproject({crs: projection2});
var prj_three=img_vh.reduceResolution({reducer: ee.Reducer.mean()}).reproject({crs: projection2});
but still got the same error.
The weird thing is that when I don't mosaic the images from imagecollection I don't get this error at all.
Here is link for the code:
https://code.earthengine.google.com/d5ba407afff4ed384ad9d1cfbf89ee6c
My end goal : to be able to reproject the layers and export as one raster with three bands that have the same projection
edit: if instead of using mosaic to create my image I use "first()" I get the image but it doesnt help me because then I don't get the full image.