[gdal-dev] default for RelativeToVRT field

Even Rouault even.rouault at spatialys.com
Sat Apr 23 02:37:44 PDT 2022


Michael,

> Or is it just a matter of forcing an input path to be absolute?

for regular use cases (ie VRT name not set to empty), you might not even 
been able to do that in master since 
https://github.com/OSGeo/gdal/commit/6d7001656d06af138f8e46ff1651056626db11e8 
which tries to write relative filename as much as possible, even if all 
paths are absolute

Testing with your use case with empty VRT filename, I see the behavior 
has not changed, and that you'll indeed get relativeToVRT="0" only if 
using a source dataset with an absolute path. For most use cases where 
you use an empty filename, it doesn't matter much because you don't 
actually re-open it and use it immediately, and thus the source dataset 
is not re-opened. I can imagine though that you could get into trouble 
if serializing it from the xml:VRT content and re-opening the resulting VRT.

> Is it possible to force GDAL to make the SourceFilename absolute by 
> setting options?

The solution would probably be to add an explicit creation option to the 
VRT driver, like SOURCE_PATH=ABSOLUTE, that would override the current 
heuristics.

Even

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list