[gdal-dev] How to specify extent of a VRTWarpedDataset in Python?

Anton Korosov anton.korosov at nersc.no
Wed Jun 1 05:08:59 EDT 2011


Hi!
we are developing software for automatic processing of satellite data 
and decided to base it mostly on GDAL-Python bindings. Can I ask you 
about options to create Warped VRT datasets in Python?

1. The command

gdalwarp -t_srs '+proj=utm +zone=24 +datum=WGS84' -of VRT -tr 1000 1000 
-te -1000000 7000000 2000000 10000000 input.tif output.vrt

creates a VRT file of subclass VRTWarpedDataset. The size, resolution 
and spatial reference is specified by the options of that command.
Is there any way I can create such VRTWarpedDataset using GDAL-Python 
bindings?

I'm afraid that with the function gdal.AutoCreateWarpedVRT() I can 
specify only spatial reference (i.e. UTM Zone) but not raster size and 
resolution. Am I right?
Of course I can edit the generated VRT file and adjust RasterXSize, 
RasterYSize, GeoTransform and DstGeoTransform manually. But is there any 
way to do that programmatically?


2. How can I convert the VRT dataset generated by AutoCreateWarpedVRT 
into a string without writing to disk? That's necessary since a VRT from 
a MERIS full swath exceeds 6 MB. Also for our applications it would be 
much more efficient to edit XML in memory and then to flush to disk with 
CreateCopy.

Thanks for support!
Anton


More information about the gdal-dev mailing list