I am trying to create an image from a numpy array and georefenrece it so that I can import it into qgis. I have the latitude and longitude in degrees for the top left corner of the array as well as the spacing for the grids in metres. My understanding is that I can use the SetGeoTransform function to set these values and then set the projection which, in my case is lcc. The problem is that the image lands on a completely different part of the canvas. For the
SetGeoTransform((originX, pixelWidth, 0, originY, 0, pixelHeight))
is it correct to set the origin in degrees and the width in metres?
Can you see what elese I am doing incorrectly?
THis is an example of the code:
import osr
import numpy
import gdal
format = "GTiff"
driver = gdal.GetDriverByName( format )
dst_ds = driver.Create( 'dst_filename.tif', 134, 164, 1, gdal.GDT_Float64)
dst_ds.SetGeoTransform( [ -10, 8000, 0, 45, 0, -8000 ] )
srs = osr.SpatialReference()
srs.ImportFromProj4('+proj=lcc +lat_1=45 +lat_2=45 +lat_0=45 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs')
dst_ds.SetProjection( srs.ExportToWkt() )
raster = numpy.zeros( (164, 134), dtype=numpy.uint64)
dst_ds.GetRasterBand(1).WriteArray(array)
# Once we're done, close properly the dataset
dst_ds = None