0

I'm using GDAL to georeference an image, but can't seem to find the information that I need.

In the sample code below the upper left (ul) and lower right (lr) corner coordinates denote not the corners of the image itself, but the corners of the bounding-box that span the image once it's been rotated around its midpoint (rotation).

I believe I've managed to translate the image as if these coordinates were its corners but that's not quite right. I could proceed by deducing the image corner coordinates and go from there but I'm hoping there's a way to let GDAL figure this out for me.

Is there some way I can feed GDAL with bounding-box coordinates and rotation like this?

import gdal

ul = (18.019981384277344, 59.32425764439889)
lr = (18.103408813476562, 59.30586128759598)
rotation = -181.46  # what I need to include somehow

ds = gdal.Open('img.bmp')
gdal.Translate(
    'img.tiff',
    ds,
    outputBounds=[*ul, *lr],
    outputSRS='EPSG:4326',
)

Edit:

I've since figured out that the parameters I have correspond to a KML Ground Overlay and that this question is pretty much the same as these two.

4

1 Answer 1

0

As far as I've been able to gather there's no standard recipe in GDAL to perform this operation. However, there is a plugin to QGIS that can and it outlines the necessary transformations for the corresponding operation in GDAL.

Your Answer

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

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