[gdal-dev] Re: VRT creation with Python

Michael Aye kmichael.aye at gmail.com
Fri Mar 26 15:12:43 EDT 2010

Frank Warmerdam wrote:
> There is no public GDAL API for modifying the sourcefilename of a VRT.
> Can you not just create the VRT files programmatically by inserting the
> filename in a template text file?
I can, but that's still more coding than with my idea of manipulating
meta-data, basically I was thinking
of something like:
* ds = gdal.Open('some.vrt')
* (maybe a ds2 = ds.Copy() or so here?)
* ds2.SetMetaDataItem('SourceFilename', 'newFileName')
* ds2.Reload() (or ds2.Open() if it's thinkable to have a ds handle while
it's 'closed'?)

Frank Warmerdam wrote:
> I don't understand your point about metadata.  Were you hoping the
> metadata for the underlying file would be passed through the VRT to
> the application? This does not occur with VRTs even when they reference
> a GDAL supported (rather than raw) file.
I understood this sentence from the  http://www.gdal.org/gdal_vrttut.html
VRT description  :

> . A special attribute of VRT datasets is that sources can be added to the
> VRTRasterBand (but not to VRTRawRasterBand) by passing the XML describing
> the source into SetMetadata() on the special domain target
> "new_vrt_sources".
like that there is at least some kind of machinery there to provide sources
to an existing VRT dataset. I read that this is not possible for
RawRasterBands, but was hoping that there are other possibles in GDAL, where
this would be possible. Anyhow, I did it myself know, creating a new VRT for
all images just before I read it.

Frank Warmerdam wrote:
> Is the .img file a PDS file?  Are you aware there is a PDS driver for
> GDAL? Are you sure you can't just access the PDS image directly?
I am aware and tried it, but got the 'unsupported format' message. I am
using PyPDS now to read the header and adapt the settings for the vrt
creation with a self-made mini xml writer.
Our PDS images are, I think, some of the most complex PDS data that there
is, with several binary subframes inside, so I guess, the gdal driver still
has to be improved for that.
I asked our team leader, if I could provide you with an example image (it's
as of yet non-public data), and he agreed. So if you like, I could send you
an FC image by email, so that you could have a look at it, and hopefully
implement it into the PDS driver.

Have a good weekend!
View this message in context: http://n2.nabble.com/VRT-creation-with-Python-tp4787592p4805793.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.

More information about the gdal-dev mailing list