I have a tile data and I would like to transform the data to a gtiff data with georeference information via gdal and python.
The tile is the quadtree tile with quad key 1321222320321122
. The left upper point of this tile is Point(114.14794921875 22.33991442556202)
(the right lower point of this tile is Point(114.1534423828125,22.334833457530486)
in case of use). The original tile file is a 256*256 png file.
I refered the code from Georeferencing raster using GDAL and Python?
Here is my code:
src_ds = gdal.Open(src_path)
driver = gdal.GetDriverByName('GTiff')
dst_ds = driver.CreateCopy(dst_path,src_ds,0)
# Set projection
gt = [114.14794921875,256,0,22.33991442556202,0,-256]
dst_ds.SetGeoTransform(gt)
srs = osr.SpatialReference()
srs.ImportFromEPSG(4326)
dest_wkt = srs.ExportToWkt()
dst_ds.SetProjection(dest_wkt)
dst_ds = None
src_ds = None
Then I directly put the generated gtiff data to QGIS, but the figure is not in a proper location (neither it locates in the same place as the origin figure.) The layer extent is (114.1479492187500000,-65513.6600855744400178 : 65650.1479492187500000,22.3399144255620214). So there must something wrong with the transform process, and I am wondering what is the right transform parameter in this case.