[gdal-dev] gdalbuildvrt save relative paths

Even Rouault even.rouault at mines-paris.org
Wed Oct 14 14:17:33 EDT 2009


Selon "Jürgen E. Fischer" <jef at norbit.de>:

Greg,

you were not enough specific to understand what when wrong for you. I'd expect
an example of the exact gdalbuildvrt command line and the current directory from
where you tried it, like Jürgen did.

Indeed in Jürgen's example, GDAL was not behaving optimally. I've fixed that in
trunk r17818.

So the behaviour is now :

1) cd /PATH/TO/THE/VRT/
gdalbuildvrt foo.vrt RELATIVE/PATH/TO/ANY/GDAL/RASTER

returns a vrt with <SourceFilename
relativeToVRT="1">RELATIVE/PATH/TO/ANY/GDAL/RASTER</SourceFilename>

Before r17818, it only worked if RELATIVE/PATH/TO/ANY/GDAL/RASTER was a filename
in the same directory as foo.vrt

2) cd /ANYWHERE/YOU/WANT

gdalbuildvrt /A/B/C/foo.vrt /A/B/C/PATH/TO/ANY/GDAL/RASTER

returns a vrt with <SourceFilename
relativeToVRT="1">PATH/TO/ANY/GDAL/RASTER</SourceFilename>

(Behaviour of 2) is unchanged by r17818)

3) cd /PATH/TO/THE/VRT/
gdalbuildvrt foo.vrt ABSOLUTE/PATH/TO/ANY/GDAL/RASTER

returns a vrt with <SourceFilename
relativeToVRT="0">ABSOLUTE/PATH/TO/ANY/GDAL/RASTER</SourceFilename>

(Behaviour of 3) is unchanged by r17818)

Even


> Hi Greg,
>
> On Wed, 14. Oct 2009 at 12:40:19 -0400, Greg Coats wrote:
> >    How does one specify that gdalbuildvrt save relative paths, rather than
> >    absolute paths?
>
> Looks like that isn't supported directly yet.  But I'd try:
>
> cd /PATH/TO/THE/VRT/
> gdalbuildvrt foo.vrt ../RELATIVE/PATH/TO/THE/DATASOURCES/*.tif
> perl -i.bak -pe 's/relativeToVRT="0"/relativeToVRT="1"/' foo.vrt
>
>
> Jürgen
>
> --
> Jürgen E. Fischer         norBIT GmbH               Tel. +49-4931-918175-20
> Dipl.-Inf. (FH)           Rheinstraße 13            Fax. +49-4931-918175-50
> Software Engineer         D-26506 Norden               http://www.norbit.de
>
> --
> norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
> Rheinstrasse 13, 26506 Norden
> GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>




More information about the gdal-dev mailing list