QGIS Georeferencing – How to Get Coordinates of Corners from KML File

gdalgeoreferencingqgis

I am currently in the process of creating a Python script, that automates certain parts of my QGIS processes. Currently I am trying to translate a PNG file to a GeoTIFF with the gdal_translate tool. However, I do not know how to get the values for the '-gcp' option.
The tool I am using automatically creates a KML file with these values:

<north> 65.28265</north>
<south> 63.48401</south>
<east> 53.18008</east>
<west> 49.01991</west>
</LatLonBox></GroundOverlay>
<Placemark><name>Overlay</name>
<Point><coordinates> 51.1, 64.383333,0
</coordinates></Point></Placemark></Folder></kml>

I also know that the PNG file, that I am trying to process, fits the polygon that gets created. So what I am trying to get are the coordinates of the corners of the polygon and afterwards map the corners of the PNG.

Does anyone have an idea on how to do this?

Best Answer

Looks like you really want to use the -a_ullr argument to set the four corners of the image. I have a png with no coordinate info, and if I do this:

$ gdal_translate -a_srs epsg:4326 -a_ullr 49.01991 65.28265 53.18008 63.48401 exceed4.png exceed4.tiff

I get a tiff with these coordinates:

Corner Coordinates:
Upper Left  (  49.0199100,  65.2826500) 
Lower Left  (  49.0199100,  63.4840100) 
Upper Right (  53.1800800,  65.2826500) 
Lower Right (  53.1800800,  63.4840100) 
Center      (  51.0999950,  64.3833300) 

and the correct coordinate system.