[gdal-dev] GetGeoTransform returning different values
Cory Foy
foyc at flighttactics.com
Fri Sep 5 12:31:48 PDT 2025
Hi Even,
>> But I also noticed the WKS seems to be different in the two as well. Is there a configuration or something else I might be missing that would cause these to be off?
> gdalinfo uses WKT_2:2019, and GetProjectionRef() uses WKT1. You can use GetSpatialRef()->exportToWKT(apszOptions) with apsOptions = { "FORMAT=WKT2_2019", nulptr } to get the same result
>
Ah, that makes sense!
>> Sorry for the bother again - I noticed that when I use gdalinfo to query a document (in this case, a GeoPDF) the geotransform coordinates are slightly different than when I can GetGeoTransform using the API on the same document with GDALOpen + GDALGetGeoTransform.
> Presumably due to a difference in number of significant digits displayed in both cases.
>
For the GeoTransform, I’m pushing them out to the same significant digits:
Gdalinfo:
-8800981.741226587, 1.534954250051887, 0.7153177546590841
4288851.899958452, 0.7158702972076904, -1.534439284842128
API:
-8800981.488120455, 1.5351602235290571, 0.7144694099544626,
4288852.103036083, 0.7156171000026056, -1.5347947295515767
From what I can see, they seem to be kind of far apart to be just significant digits. It’s calculating different pixel sizes and rotations which in turn is causing the lat/lon conversion to be off. The only other thing I can think of is that I compiled the API with PDFium and I believe the homebrew install uses Poppler. I just want to make sure I’m not misunderstanding something with how I’m using this.
Thanks!
Cory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250905/3204e846/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3965 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250905/3204e846/attachment.bin>
More information about the gdal-dev
mailing list