On Thu, 3 Mar 2022 at 11:16, Michael Sumner <mdsum...@gmail.com> wrote: > > Hello, reading the raster VRT tutorial > > https://gdal.org/drivers/raster/vrt.html#creation-of-vrt-datasets > > with this code: > > // > int nBand; > GDALDriver *poDriver = (GDALDriver *) GDALGetDriverByName( "VRT" ); > GDALDataset *poSrcDS, *poVRTDS; > poSrcDS = (GDALDataset *) GDALOpenShared( pszSourceFilename, GA_ReadOnly ); > poVRTDS = poDriver->CreateCopy( "", poSrcDS, FALSE, NULL, NULL, NULL ); > // > > Is there a way to obtained the VRT XML text representing poVRTDS without > writing to an actual file?
Check what the https://gdal.org/programs/gdalbuildvrt.html does: https://github.com/OSGeo/gdal/blob/master/apps/gdalbuildvrt_bin.cpp#L192-L196 which is this call https://github.com/OSGeo/gdal/blob/master/apps/gdalbuildvrt_lib.cpp#L1691 which uses this builder class https://github.com/OSGeo/gdal/blob/master/apps/gdalbuildvrt_lib.cpp#L1769 which is/can be built as a library and linked against. Best regards, -- Mateusz Loskot, http://mateusz.loskot.net _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev