[Gdal-dev] vrt format and absolute/relative paths

Vincent Schut schut at sarvision.com
Wed Mar 17 02:56:41 EST 2004


Frank,

thank you very much for this elegant solution.

Regards,
Vincent Schut.

On Tuesday 16 March 2004 19:39, Frank Warmerdam wrote:
> Vincent Schut wrote:
> >>Is this behaviour intended?
> >>If not, if would greatly help me if it could be changed so that gdal
> >> always uses the home directory of the current vrt file to look for the
> >> vrt raster source files.
>
> Vincent,
>
> I have modified the VRT code in CVS so that it will check for a
> relativeToVRT attribute on the SourceFilename element.  If it is set to a
> non-zero value then the SourceFilename will be treated relative to the
> virtual file.   For example:
>
> <VRTDataset rasterXSize="512" rasterYSize="512">
>    <VRTRasterBand dataType="Byte" band="1">
>      <ColorInterp>Gray</ColorInterp>
>      <SimpleSource>
>        <SourceFilename relativeToVRT="1">utm.tif</SourceFilename>
>        <SourceBand>1</SourceBand>
>        <SrcRect xOff="0" yOff="0" xSize="512" ySize="512"/>
>        <DstRect xOff="0" yOff="0" xSize="512" ySize="512"/>
>      </SimpleSource>
>    </VRTRasterBand>
> </VRTDataset>
>
> Currently CreateCopy() does not attempt to set this, and relativize the
> path though it might at some point in the future.
>
> In general, even when doing a gdal_translate the .vrt may be put somewhere
> completely unrelated to the actual files in which case it is hard to make
> the SourceFilename relative to the .vrt.  While it has some significant
> problems the code (for the time being) will just literally place whatever
> filename you give it for the the input file into the SourceFilename
> element.
>
> However, with a minor hand edit to your .vrt files you should now be able
> to use them as desired.
>
> Best regards,

-- 
-----------------------------
 Vincent Schut
 SarVision B.V.
 Wageningen, The Netherlands
 www.sarvision.com



More information about the Gdal-dev mailing list