<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <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 class="moz-cite-prefix">Le 03/03/2022 à 11:14, Michael Sumner a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAAcGz9-AU5m1oxu18cxgz=9rmUrzPnYki7yEBsmnwO3zkZcvEw@mail.gmail.com">
      <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"
            moz-do-not-send="true" class="moz-txt-link-freetext">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" 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"
              moz-do-not-send="true" class="moz-txt-link-freetext">mdsumner@gmail.com</a></div>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>