Friday, 30 August 2013 if you can think it, you can do it

Hi all,
today I'll write a post about a python script I used to edit the projection of an old geotiff, to import it in the GIS I am managing for Aramus archaeological mission 2013. To understand why I needed to use such a script, I have to explain briefly the problem occurred this year.
Since eight years (2006), Arc-Team is supporting the excavation in Aramus (AR), currently leaded by Dott. Walter Kuntner of Insbruck University (Institut für Alte Geschichte und Altorientalistik), in colaboration with Prof. Hayk Avetissian (Yerevan State University). In 2006 Ing. Klaus Kerkow and Christine Hanisch produced an high resolution aerial map of Aramus hill, using S-42 geodetic datum (with the Krassowsky ellipsoid). Unfortunatley, since 2004, Aramus project has been set up on a modified version of S-42, to avoid bureaucratic problems. This is the reason why I had to convert the aerial map geotif from the Krassowsky-Pulkovo to the local Aramus system. If I could work with a georeferenced raster and a plain world file, it would have been simple to solve the problem, just modifying the coordinates directly in the code... but working with a geotiff, things became more complicated. I could georeference again the aerial map, but I wanted to spare time and keep the same quality of the original raster. Luckily Walter Kuntner found the right solution in internet:, a simple scrit able to "edit in place various information of an existing GDAL dataset (projection, geotransform, nodata, metadata)". I checked quickly If I had this script in my GDAL files, but I did not find it, so I simply copied the source code from the OSGeo SVN repository, at (this link) and I saved it in a .py file. Than I get the coordinates of the upper left and lower right corner of my geotiff in OpenJUMP ...

Copying the upper left coordinates of the geotif

... and finally I modified the GDAL dataset with this command:

python gdal_edit -a_ullr ulx uly lrx lry

where ulx and uly stand for the new x and y coordinates of the upper left corner of the geotif, while lrx and lry are the new x and y coordinates for the lower right corner.
I know that this problem is not very common, but I hope that this post will be anyway somehow useful to ATOR readers.
Have a nice day!
BlogItalia - La directory italiana dei blog Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.