<div dir="ltr">I would like to control the relativeToVRT field by setting it to 0/false, it seems the only way to do that is to give a non-local or absolute path to the *output* file, or give an absolute path for the input. . <div><br></div><div>intif=autotest/gdrivers/data/gtiff/byte_signed.tif<br>abtif="$(pwd)"/$intif<br>gdal_translate $intif -of VRT here.vrt<br>gdal_translate $intif -of VRT /tmp/there.vrt<br>gdal_translate $abtif -of VRT here_abs.vrt<br><br>grep relative here.vrt<br>      <SourceFilename relativeToVRT="1">a ...<br>grep relative /tmp/there.vrt<br>      <SourceFilename relativeToVRT="0">/p ...<br>grep relative here_abs.vrt<br>      <SourceFilename relativeToVRT="0">/p ...<br></div><div><br></div><div>It's the same in C++, if 'pszFilename' is relative the value is 1, if absolute it is 0. </div><div><br></div><div>  GDALDataset *poSrcDS = (GDALDataset *)GDALOpenShared(pszFilename, GA_ReadOnly);<br><br>  GDALDriver *poDriver = (GDALDriver *) GDALGetDriverByName( "VRT" );<br>  GDALDataset *poVRTDS = poDriver->CreateCopy("", poSrcDS, false, NULL, NULL, NULL);<br><br>  const char *xmlvrt = poVRTDS->GetMetadata("xml:VRT")[0];<br>  <br></div><div>Is it possible to force GDAL to make the SourceFilename absolute by setting options? Or is it just a matter of forcing an input path to be absolute? </div><div><br></div><div>I'm concerned about cases of relative paths with prefixes, I want to create in-memory VRT text that *always* has absolute paths for exactly this CreateCopy("", ) situation with no actual VRT file. </div><div><br></div><div>Thank you, Mike</div><div><br></div><div><br></div><div><br></div><div>--<br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Michael Sumner<br>Software and Database Engineer<br>Australian Antarctic Division<br>Hobart, Australia<br>e-mail: <a href="mailto:mdsumner@gmail.com" target="_blank">mdsumner@gmail.com</a></div></div></div>