Balazs,<br><br>If you want to programatically perform the actions of gdalwarp, it&#39;s best to go through the code of grapwarp.cpp<br><a href="http://trac.osgeo.org/gdal/browser/trunk/gdal/apps/gdalwarp.cpp">http://trac.osgeo.org/gdal/browser/trunk/gdal/apps/gdalwarp.cpp</a><br>
<br>There are some more test scripts you can refer, if you want to do this through command line.<br><a href="http://trac.osgeo.org/gdal/browser/trunk/autotest/warp/warp.py">http://trac.osgeo.org/gdal/browser/trunk/autotest/warp/warp.py</a><br>
<a href="http://trac.osgeo.org/gdal/browser/trunk/autotest/utilities/test_gdalwarp.py">http://trac.osgeo.org/gdal/browser/trunk/autotest/utilities/test_gdalwarp.py</a><br><br><div class="gmail_quote">On Thu, Aug 4, 2011 at 5:26 PM, Balazs Szabó <span dir="ltr">&lt;<a href="mailto:szabobaa@gmail.com">szabobaa@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr">Dear list!<br><br>How can I use this two bash command with gdal-python bindings? <br>
<br>gdal_translate -of GTiff  -a_srs EPSG:xxxx -gcp 775 560 20.58329 48.12650  -gcp 9518 539 20.8329 48.12650  -gcp 9525 7136 20.83329 48.00150  -gcp 758 7134 20.58329 48.00150  o.tif s.tif<br>
gdalwarp -tps s.tif t.tif <br><br>[I can done this task by os.popen(&#39;gdalwarp -tps s.tif t.tif&#39;) ]<br>I found some code here: <a href="http://svn.osgeo.org/gdal/trunk/autotest/gcore/transformer.py" target="_blank">http://svn.osgeo.org/gdal/trunk/autotest/gcore/transformer.py</a><br>

But after this line ( tr = gdal.Transformer( ds, None, [ &#39;METHOD=GCP_TPS&#39; ] )) I dont know how can I warping my hole raster.<br><br>Here is my python code:<br><br>import osgeo.gdal<br>import osgeo.osr<br>import os<br>

<br>osgeo.gdal.AllRegister()<br>
driver=osgeo.gdal.GetDriverByName(&#39;GTiff&#39;)<br><br>src=&#39;path/to/orig/o.tif&#39;<br>dst=&#39;path/to/t.tif&#39;<br>gcps=give_me_gcps() # I got a list like [gcp1,gcp2...]<br><br>t_srs=osgeo.osr.SpatialReference() <br>

t_srs.ImportFromEPSG(xxxx)<br><br>s_img=osgeo.gdal.Open(src)<br>s_img_cols=s_img.RasterXSize<br>s_img_rows=s_img.RasterYSize<br><br><br>t_img=driver.Create(dst,s_img_cols,s_img_rows,3,osgeo.gdal.GDT_Byte) # Create a new image<br>

t_img.SetGCPs(gcps,t_srs.ExportToWkt())<br><br>for band_num in range(s_img.RasterCount):<br>        # copying the original tif bands<br>        band=s_img.GetRasterBand(band_num+1)<br>        inData=band.ReadAsArray(0,0,cols,rows)<br>

        outBand=t_img.GetRasterBand(band_num+1)<br>        outBand.WriteArray(inData,0,0)<br>        outBand.FlushCache()<br><br><br># ????<br><br>s_img=None    <br>t_img=None<br><br><br>Thanks in advance<br>Best regards,<br>

<br>Balazs<br></div>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br>
<br>+91-9494447584<br>17.2416N 80.1426E<br>