<div dir="ltr">Thank you Vadim!<div><br></div><div>I tried the <meta http-equiv="content-type" content="text/html; charset=utf-8">.GCPsToGeoTransform() method, and it is ok, but in the geotransform tuple (geotransform[0],geotransform[3] ) gave me fake starting point. </div>
<div><br></div><div>Anyway, your python programs are very useful! ( I am a self made programmer, so those py files are very helpful for me!).</div><div><br></div><div>Best regards,</div><div>Balazs</div><div><br></div><div>
<br></div><div><br></div><div>011/8/8 Vadim Shlyakhov <span dir="ltr">&lt;<a href="mailto:vadp.devl@gmail.com">vadp.devl@gmail.com</a>&gt;</span></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Balazs,<br>
<div class="im"><br>
On Thu, Aug 4, 2011 at 3:56 PM, Balazs Szabó &lt;<a href="mailto:szabobaa@gmail.com">szabobaa@gmail.com</a>&gt; wrote:<br>
&gt; Dear list!<br>
&gt;<br>
&gt; How can I use this two bash command with gdal-python bindings?<br>
&gt;<br>
&gt; gdal_translate -of GTiff  -a_srs EPSG:xxxx -gcp 775 560 20.58329 48.12650<br>
&gt; -gcp 9518 539 20.8329 48.12650  -gcp 9525 7136 20.83329 48.00150  -gcp 758<br>
&gt; 7134 20.58329 48.00150  o.tif s.tif<br>
<br>
</div>for  gdal_translate you could do something like this:<br>
<br>
            out_format=&#39;VRT&#39;<br>
            ext=&#39;.&#39;+out_format.lower()<br>
            dst_file= os.path.basename(base+ext).encode(&#39;utf-8&#39;) # output file<br>
            img_path=os.path.relpath(self.img_file,dst_dir).encode(&#39;utf-8&#39;)<br>
<br>
            src_ds = gdal.Open(img_path,GA_ReadOnly)<br>
            dst_drv = gdal.GetDriverByName(out_format)<br>
            dst_ds = dst_drv.CreateCopy(dst_file,src_ds,0)<br>
            dst_ds.SetProjection(self.srs)<br>
<br>
            #double x = 0.0, double y = 0.0, double z = 0.0, double<br>
pixel = 0.0,<br>
            #double line = 0.0, char info = &quot;&quot;, char id = &quot;&quot;<br>
            gcps=[gdal.GCP(c[0],c[1],0,p[0],p[1],&#39;&#39;,i) for i,p,c in self.refs]<br>
            dst_ds.SetGCPs(gcps,self.refs.srs())<br>
            dst_geotr=gdal.GCPsToGeoTransform(gcps)<br>
            dst_ds.SetGeoTransform(dst_geotr)<br>
<br>
            del dst_ds # close dataset<br>
<div class="im"><br>
&gt; gdalwarp -tps s.tif t.tif<br>
<br>
</div>For this I was just using a few templates to assemble VRT description<br>
&quot;manually&quot; then feed it into drv.CreateCopy().<br>
<br>
Perhaps this is not the most elegant solution, but if you need a<br>
sample you may have a look at my gdal_tiler.py script (function<br>
make_base_raster). You can find it here:<br>
<a href="http://tilers-tools.googlecode.com/files/tilers_tools-2.2.tar.gz" target="_blank">http://tilers-tools.googlecode.com/files/tilers_tools-2.2.tar.gz</a>. Just<br>
to note: for SRSes the script internally uses proj4 notation, but this<br>
wouldn&#39;t obligatory in your case.<br>
<br>
Ironically this was also evolved from some bash script some time ago.<br>
<br>
Hope this helps.<br>
<font color="#888888">VS<br>
</font></blockquote></div><br></div></div>