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)