[gdal-dev] VRT creation with Python

Frank Warmerdam warmerdam at pobox.com
Tue Mar 23 22:11:13 EDT 2010


Michael Aye wrote:
> Dear all,
> 
> I have some, as of yet unpublished, PDS data I am reading via a well working
> simple vrt definition looking like this:
> 
> <VRTDataset rasterXSize="1092" rasterYSize="1056">
>  <VRTRasterBand dataType="UInt16" band="1" subClass="VRTRawRasterBand">
>    <SourceFilename
> relativetoVRT="1">FC1_2005-06-23T21.55.54.000Z_ID10_0000019407_F1.img</SourceFilename>
>    <ImageOffset>8704</ImageOffset>
>    <PixelOffset>2</PixelOffset>
>    <LineOffset>2184</LineOffset>
>    <ByteOrder>LSB</ByteOrder>
>  </VRTRasterBand>
> </VRTDataset>
> 
> which is saved as a FC1.vrt file.
> 
> How can I programmatically opening many more of these images without
> creating another vrt file for each?
> Basically, how can I change the SourceFilename programmatically for the
> loaded virtual driver? For the dataset I can't see a handle, as the metadata
> for a dataset I load in with this vrt is empty.

Michael,

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 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.

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?

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list