SetGeoReference it is not working with this code. (I think that I should need some more explanation on how this works...)
"""
Retrieve Georef & Projection from a reference image
"""
ReferenceTif = gdal.Open(img_path_tif)
GeoRef = ReferenceTif.GetGeoTransform() #I take the geo ref of the ref image
projRef = ReferenceTif.GetProjection() #I take the proj as of the ref image
print(GeoRef)
(654000.0, 0.3, 0.0, 4203000.0, 0.0, -0.3)
"""
Set the Georef & Projection of a image
"""
test = gdal.Open('test.tif') #Open a new image
test.SetProjection(proj) #Set the projection like the ref image
test.SetGeoTransform(GeoRef) #Set the GeoRef like the ref image
"""
Check if the work is done
"""
result = test.GetGeoTransform() #Get the GeoRef of the test image
print(result==GeoRef) #Check if the work is done correctly
print(result)
False (0.0, 1.0, 0.0, 0.0, 0.0, 1.0)
Any ideas ?