<div dir="ltr"><div dir="ltr">Excellent, Even - thanks so much, I have this working now.  I've crafted a PR for the example. <div><br></div><div>Mateusz: thank you for the source code overview, I will be using that too. </div><div><br></div><div>Best, Mike</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 6, 2022 at 10:18 PM Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <p>Michael,</p>
    <p>yes you can get the VRT XML text with:</p>
    <p>poVRTDS->GetMetadata("xml:VRT")[0]</p>
    <p>If you can submit a pull request documenting that, that would be
      welcome</p>
    <p>Even<br>
    </p>
    <div>Le 03/03/2022 à 11:14, Michael Sumner a
      écrit :<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hello, reading the raster VRT tutorial
        <div><br>
        </div>
        <div><a href="https://gdal.org/drivers/raster/vrt.html#creation-of-vrt-datasets" target="_blank">https://gdal.org/drivers/raster/vrt.html#creation-of-vrt-datasets</a><br>
        </div>
        <div><br>
        </div>
        <div>with this code: </div>
        <div><br>
        </div>
        <div>//</div>
        <div>int   nBand;<br>
          GDALDriver *poDriver = (GDALDriver *) GDALGetDriverByName(
          "VRT" );<br>
          GDALDataset *poSrcDS, *poVRTDS;<br>
          poSrcDS = (GDALDataset *) GDALOpenShared( pszSourceFilename,
          GA_ReadOnly );<br>
          poVRTDS = poDriver->CreateCopy( "", poSrcDS, FALSE, NULL,
          NULL, NULL );<br>
          <div>//</div>
          <div><br>
          </div>
          <div>Is there a way to obtained the VRT XML text representing
            poVRTDS without writing to an actual file? </div>
          <div><br>
          </div>
          <div>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. </div>
          <div><br>
          </div>
          <div>Thanks for your help. </div>
          <div><br>
          </div>
          <div>Best, Mike</div>
          <div><br>
          </div>
          <div><br>
          </div>
          -- <br>
          <div dir="ltr">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>
      <br>
      <fieldset></fieldset>
      <pre>_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre cols="72">-- 
<a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </div>

</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="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>