<span class="Apple-style-span" style="font-family: Times; font-size: 16px; "><div style="margin-top: 8px; margin-right: 8px; margin-bottom: 8px; margin-left: 8px; font: normal normal normal small/normal arial; "><div class="gmail_quote">
<div>Hi,</div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
If I know the co-ordinates for all 4 corners of a non-north-up image, how<br>can I calculate the 6 GDAL affine transform parameters?<br></blockquote></div><div><br></div><div>There is a script gcps2wld.py in GDAL:</div><div>
<br></div><div>You should assign the corners (ground control points)&nbsp;to a raster&nbsp;by:</div><div><br></div><div>gdal_translate -of vrt -gcp 0 0 19.3 50.5 ... input.tif temp.vrt</div><div><br></div><div>and then</div><div><br>
</div><div><div>gcps2wld.py temp.vrt<br></div><div><br></div><div>will return a world file.</div></div><div><br></div><div>Best regards</div><div><br></div><div>Klokan</div><div><br></div><div>P.S.</div><div>Direct calculation in pure python is possible for example with:</div>
<div><a href="http://code.google.com/p/oldmapsonline/source/browse/trunk/gcps2wld/python-no-dep/gcps2wld.py">http://code.google.com/p/oldmapsonline/source/browse/trunk/gcps2wld/python-no-dep/gcps2wld.py</a><br></div><div>
<br></div><div>with documetation and a Java version at:<br></div><div><a href="http://blog.oldmapsonline.org/2008/06/georeferencing-images-by-control-points.html">http://blog.oldmapsonline.org/2008/06/georeferencing-images-by-control-points.html</a></div>
</div></span>