I have two sets of glib2 data from different sources which I would like to process together.
Each image has a different projection and resolution (I don't know if resolution is the correct word to use here.)
for example, here are my two images:
both of these images I generated by parsing the glib2 data and writing the output to geotiff. Here's my code:
data = gdal.Open(file) driver = gdal.GetDriverByName('GTiff') image = driver.Create(output_file, sizex, sizey, 4, gdal.GDT_Byte) image.SetGeoTransform(data.GetGeoTransform()) image.SetProjection(data.GetProjection()) band = data.GetRasterBand(1).ReadAsArray() shape = numpy.shape(band) r = image.GetRasterBand(1) g = image.GetRasterBand(2) b = image.GetRasterBand(3) a = image.GetRasterBand(4) aarray = a.ReadAsArray() #.. scale arrays r.WriteArray(band) r.FlushCache() g.WriteArray(band) g.FlushCache() b.WriteArray(band) b.FlushCache() a.WriteArray(aarray) a.FlushCache() image = None
I have tried parsing in both sets of glib2 data and then at the point where I'm setting the projection and geotransform I use the other set of transforms than the data.
data_1 = gdal.Open(file_1) data_2 = gdal.Open(file_2) image.SetGeoTransform(data_2.GetGeoTransform()) image.SetProjection(data_2.GetProjection()) band = data_1.GetRasterBand(1).ReadAsArray()
So the data used is different from the transform and projection used.
When I do this, it makes no visible difference. It seems like the change in the transform and projection have no impact.
I know I'm way off base here, because I think I need to use the same transform and projection data as I do the actual data, but I don't know how to transform the image to another projection.
How do I do this?