[gdal-dev] gdalwarp under python
szabobaa at gmail.com
Mon Aug 8 10:42:46 EDT 2011
Thank you Vadim!
I tried the .GCPsToGeoTransform() method, and it is ok, but in the
geotransform tuple (geotransform,geotransform ) gave me fake starting
Anyway, your python programs are very useful! ( I am a self made programmer,
so those py files are very helpful for me!).
011/8/8 Vadim Shlyakhov <vadp.devl at gmail.com>
> Hi Balazs,
> On Thu, Aug 4, 2011 at 3:56 PM, Balazs Szabó <szabobaa at gmail.com> wrote:
> > Dear list!
> > How can I use this two bash command with gdal-python bindings?
> > 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
> > 7134 20.58329 48.00150 o.tif s.tif
> for gdal_translate you could do something like this:
> dst_file= os.path.basename(base+ext).encode('utf-8') # output
> src_ds = gdal.Open(img_path,GA_ReadOnly)
> dst_drv = gdal.GetDriverByName(out_format)
> dst_ds = dst_drv.CreateCopy(dst_file,src_ds,0)
> #double x = 0.0, double y = 0.0, double z = 0.0, double
> pixel = 0.0,
> #double line = 0.0, char info = "", char id = ""
> gcps=[gdal.GCP(c,c,0,p,p,'',i) for i,p,c in
> del dst_ds # close dataset
> > gdalwarp -tps s.tif t.tif
> For this I was just using a few templates to assemble VRT description
> "manually" then feed it into drv.CreateCopy().
> Perhaps this is not the most elegant solution, but if you need a
> sample you may have a look at my gdal_tiler.py script (function
> make_base_raster). You can find it here:
> http://tilers-tools.googlecode.com/files/tilers_tools-2.2.tar.gz. Just
> to note: for SRSes the script internally uses proj4 notation, but this
> wouldn't obligatory in your case.
> Ironically this was also evolved from some bash script some time ago.
> Hope this helps.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gdal-dev