I am using GDAL library in C++. On my dataset, I have obtained geo transform with GetGeoTransform to GT array (GCP is NULL).

Than I use this values for this equation (Source):

Xgeo = GT(0) + Xpixel*GT(1) + Yline*GT(2)
Ygeo = GT(3) + Xpixel*GT(4) + Yline*GT(5)

I also add 0.5 offset to Xpixel and Yline, to calculate coordinate in the "center" of pixel.

If I put [0,0], I got correct result in lat/lon. However, if I change Yline to something other than 0, my longitude is messed up - instead of 44.0, I got -349.2... (latitude is still correct). What am I doing wrong ?

My data informations - origin, pixel size and top left are taken from GT array used in equation above; projection is GetProjectionRef

Projection is `GEOGCS["Coordinate System imported from GRIB file",DATUM["unknown",SPHEROID["Sphere",6371200,0]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]'
Origin = (0,0) - GT(2), GT(4)
Pixel Size = (0.5,-33.268) - GT(1), GT(5)
Top Left = (5.75,66.634) - GT(0), GT(3)
  • Add bebug of all value and type passed in tour formulas.thanks Nov 28, 2015 at 9:18

1 Answer 1


You should correct the size of your pixel in Y. -33 degree is definitely too much.

  • That is, what I get from GDAL on opened data. I am not editing those values. Dec 23, 2013 at 12:15

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.