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. .
intif=autotest/gdrivers/data/gtiff/byte_signed.tif abtif="$(pwd)"/$intif gdal_translate $intif -of VRT here.vrt gdal_translate $intif -of VRT /tmp/there.vrt gdal_translate $abtif -of VRT here_abs.vrt grep relative here.vrt <SourceFilename relativeToVRT="1">a ... grep relative /tmp/there.vrt <SourceFilename relativeToVRT="0">/p ... grep relative here_abs.vrt <SourceFilename relativeToVRT="0">/p ... It's the same in C++, if 'pszFilename' is relative the value is 1, if absolute it is 0. GDALDataset *poSrcDS = (GDALDataset *)GDALOpenShared(pszFilename, GA_ReadOnly); GDALDriver *poDriver = (GDALDriver *) GDALGetDriverByName( "VRT" ); GDALDataset *poVRTDS = poDriver->CreateCopy("", poSrcDS, false, NULL, NULL, NULL); const char *xmlvrt = poVRTDS->GetMetadata("xml:VRT")[0]; 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? 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. Thank you, Mike -- Michael Sumner Software and Database Engineer Australian Antarctic Division Hobart, Australia e-mail: mdsum...@gmail.com
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev