[gdal-dev] gdal.BuildVRT with an empty destination

Patrick Young patrick.mckendree.young at gmail.com
Wed Mar 13 08:38:13 PDT 2019


Thanks Even, this is awesome functionality! Definitely makes it even easier
to work with VRTs in memory!

On Wed, Mar 13, 2019 at 3:37 AM Even Rouault <even.rouault at spatialys.com>
wrote:

> On mardi 12 mars 2019 16:42:34 CET Patrick Young wrote:
> > Hi all,
> >
> > I was browsing some GDAL test cases and came across some tests like so:
> >
> > ds = gdal.BuildVRT('',...)
> >
> > aka the destination is an empty string.  Is the returned dataset a purely
> > in memory object in this case?  I assume it is safe to use like any other
> > dataset; some of the other VRT related tests are using "/vsimem/..." as
> the
> > destination, wasn't sure if one form should be prefered over another for
> > quick in memory vrt building.
> >
>
> If you use an empty string as the VRT filename, then it is not serialized
> at
> all when closing it, so you can't reopen it. You must use the dataset
> handle
> returned by gdal.BuildVRT() directly. Once the handle is closed, all
> associated memory is freed.
>
> If using '/vsimem/foo.vrt', then the VRT XML will be serialized in this
> filename, and you can re-open it later in the same process. And possibly
> gdal.Unlink() the file once done with it to clear memory (if using loops
> with
> unique filnemames, etc)
>
> Even
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20190313/b4125c8f/attachment.html>


More information about the gdal-dev mailing list