Cory, I apologize. I'm not familiar with the GetExtent() function. So this is just a guess and feel free to ignore it. Given that GetExtent() reports 2 coordinates, it seems to describe an axis aligned bounding. GeoTransform() provides information to describe an oriented bounding box. Could this perhaps be the source of disagreement between the two routines?
David On Thu, Sep 4, 2025 at 12:26 PM Cory Foy via gdal-dev < gdal-dev@lists.osgeo.org> wrote: > Hi David, > > On Sep 4, 2025, at 9:25 AM, David Klaus <dkl...@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 > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/gdal-dev > Disclaimer The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev