This might be easy, but my search has not been successful yet...

I have a multiband raster file that contains projection and geotransform metadata. When I write my file into an array, I would like to have the x and y values set according to the coordinate system.

This is what I have so far

dataset = gdal.Open('placeGlacier_05_June04.bsq')

geotransform = dataset.GetGeoTransform()
if geotransform:
    print("Origin = ({}, {})".format(geotransform[0], geotransform[3]))
    print("Pixel Size = ({}, {})".format(geotransform[1], geotransform[5]))


Output: (518320.38, 2.0, -0.0, 5589402.5, -0.0, -2.0)

Now, how do I use the geotransform information to set the Eastings and Northings as my x,y values when I write my dataset as an array

img = dataset.ReadAsArray()

** Note that this is a very large ENVI bsq/hdr dataset of size 6356 x 8848 x 451


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.