Hi Bishwarup, <div><br></div><div>some time ago I needed something like that. I got it with gdal and osr. </div><div><br></div><div>Here is the Python snippet:</div><div>---------------------------------------------------------------</div>

<div># <b>Python terminal</b>: First, get the transform parameters, you&#39;ll use them after in the code</div><div><div>dataset = gdal.Open(&quot;/ruta/archivo_original.tif&quot;, gdal.GA_ReadOnly)</div><div>parameters = ds.GetGeoTransform()</div>

<div>---------------------------------------------------------------</div><div># <b>On a separate Python file</b></div><div>import numpy</div><div>from osgeo import gdal</div><div>from osgeo import osr</div><div><br></div>

<div># Cargue del archivo que contiene la matriz</div><div>array = numpy.loadtxt(&quot;/ruta/archivo_cp1&quot;,delimiter=&#39;;&#39;)</div><div><br></div><div># Formato de salida</div><div>out_driver = gdal.GetDriverByName(&quot;GTiff&quot;)</div>

<div><br></div><div># Creación del DataSet de salida</div><div>outds = out_driver.Create(&quot;/ruta/archivo_salida.tif&quot;, 1272, 787, 1,</div><div>    gdal.GDT_Float32, options=[&quot;COMPRESS=PACKBITS&quot;,&quot;TFW=YES&quot;] )</div>

<div><br></div><div># <b>Here you should put the parameters you got before</b></div><div>outds.SetGeoTransform([552910.96327099996,28.5,0.0,422591.15634099999,0.0,-28.5])</div><div><br></div><div># Definir el sistema de referencia de la imagen de salida</div>

<div>srs = osr.SpatialReference()</div><div>srs.ImportFromEPSG( 32618 )</div><div>outds.SetProjection( srs.ExportToWkt() )</div><div><br></div><div># Escribir la matriz &#39;array&#39; en la primera banda de la imagen de salida</div>

<div>outband = outds.GetRasterBand( 1 )</div><div>outband.WriteArray( array )</div></div><div>---------------------------------------------------------------</div><div> </div><div>Hope it helps you.</div><div><br></div><div>

<br></div><div>Regards, </div><div><br></div><div>Germán</div><div><br><br><div class="gmail_quote">On Tue, Nov 2, 2010 at 9:21 AM, Barry Rowlingson <span dir="ltr">&lt;<a href="mailto:b.rowlingson@lancaster.ac.uk" target="_blank">b.rowlingson@lancaster.ac.uk</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div></div><div>On Tue, Nov 2, 2010 at 1:53 PM, Bishwarup Banerjee<br>
&lt;<a href="mailto:bishwarup.banerjee@gmail.com" target="_blank">bishwarup.banerjee@gmail.com</a>&gt; wrote:<br>
&gt; Dear All,<br>
&gt;<br>
&gt; Can any body help me to get and set projection parameters for raster files?<br>
&gt;<br>
&gt; I am doing some map calculation using PIL and the data is losing projection,<br>
&gt; so want to re project the raster files.<br>
&gt;<br>
&gt; The language I am using is Python on windows platform..<br>
<br>
</div></div> Assuming this is a qgis question...<br>
<br>
 If you get the layer in &#39;l&#39; then l.crs() gets you a coordinate<br>
reference system object:<br>
<br>
&gt;&gt;&gt; l.crs()<br>
&lt;qgis.core.QgsCoordinateReferenceSystem object at 0xb3b44ac&gt;<br>
<br>
and hence:<br>
<br>
&gt;&gt;&gt; l.crs().toProj4()<br>
PyQt4.QtCore.QString(u&#39;+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs&#39;)<br>
<br>
 and to set it, just use setCrs with a QgsCoordinateReferenceSystem object.<br>
<br>
Barry<br>
_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>-----------<br>  |\__  <br>(:&gt;__)(<br>  |/    <br><br>Soluciones Geoinformáticas Libres                            <br><a href="http://geotux.tuxfamily.org/" target="_blank">http://geotux.tuxfamily.org/</a><br>



</div>