[gdal-dev] Corner Coordinates for GeoTIFF/GeoPDF
Cory Foy
foyc at flighttactics.com
Thu Sep 4 09:25:41 PDT 2025
Hi David,
> On Sep 4, 2025, at 9:25 AM, David Klaus <dklaus at carlsonsw.com> wrote:
>
> So I apologize if I misunderstood your question, but it sounds like you may be trying to implement a geographic to grid transformation of a GeoPDF via a matrix transformation of the four corners of the PDF?
Sort of. And again, my apologies as I’m not a GIS expert either. Basically I’m reading in GeoPDFs and GeoTIFFs and need to place them overlaid on a map. For KMZ ImageOverlays this happens one of two ways - either coordinates of the four corners and a rotation degree for rectangles, or four coordinates when the image has been stretched at which point I use a transformation matrix to mold it into shape.
For the GeoPDFs I have to read in the corner coordinates, which I back ported the new GetExtent method to do. The corner coordinates look like this:
Corner Coordinates:
Upper Left (-8800981.741, 4288851.900) ( 79d 3'38.03"W, 35d54'51.91"N)
Lower Left (-8800543.967, 4287912.823) ( 79d 3'23.87"W, 35d54'27.31"N)
Upper Right (-8799766.057, 4289418.869) ( 79d 2'58.72"W, 35d55' 6.76"N)
Lower Right (-8799328.283, 4288479.792) ( 79d 2'44.56"W, 35d54'42.16"N)
Center (-8800155.012, 4288665.846) ( 79d 3'11.30"W, 35d54'47.03”N)
But when I call GetExtent the corner coordinates don’t match the above output. It seems like the corners are off because they need to be rotated / have the GeoTransform matrix applied to them.
The coordinates I get back from GetExtent:
[-79.06056186031576, -79.04571179080727, 35.907586153625296, 35.9185435558059]
The GeoTransform:
-8800981.741226587, 1.534954250051887, 0.7153177546590841
4288851.899958452, 0.7158702972076904, -1.534439284842128
I guess what I’m looking for is how to get the corner coordinates specified from gdalinfo above
> I have written software to place imagery geolocated using geographic coordinates into documents geolocated using grid coordinates. I spoke with a geodesist at my company about a similar issue and he recommended that I take a sample of points across the image, transform these points from geographic coordinates to grid coordinates and compute a best fit affine transformation between the two sets of points.
We’ve found for most of our images that the four corner coordinates work just fine for our use cases, which are more about things like lining up with roads etc (think of an event map PDF for a festival). I’m just not sure why GetExtent doesn’t seem to be applying the transformation (or maybe I’m just misunderstanding what it’s supposed to do or how I should get those values!)
Cory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250904/31d75fcf/attachment-0001.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/20250904/31d75fcf/attachment-0001.bin>
More information about the gdal-dev
mailing list