[gdal-dev] VRT dataset to text in-memory?

Even Rouault even.rouault at spatialys.com
Sun Mar 6 03:18:52 PST 2022


Michael,

yes you can get the VRT XML text with:

poVRTDS->GetMetadata("xml:VRT")[0]

If you can submit a pull request documenting that, that would be welcome

Even

Le 03/03/2022 à 11:14, Michael Sumner a écrit :
> 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?
>
> Sorry if this is obvious, haven't been able to find an example that 
> does what I want. I've seen examples using GetMetadataItem from a band 
> for parts of the XML, but can't see how to get the entire thing.
>
> Thanks for your help.
>
> Best, Mike
>
>
> -- 
> Michael Sumner
> Software and Database Engineer
> Australian Antarctic Division
> Hobart, Australia
> e-mail: mdsumner at gmail.com
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220306/5aa7e3fa/attachment.html>


More information about the gdal-dev mailing list