[gdal-dev] vrt: prevent opening all source files on open?

Even Rouault even.rouault at spatialys.com
Mon Aug 28 03:30:51 PDT 2017


Vincent,

http://gdal.org/gdal_vrttut.html should help:

"""Some characteristics of the source band can be specified in the optional SourceProperties 
tag to enable the VRT driver to differ the opening of the source dataset until it really needs 
to read data from it. This is particularly useful when building VRTs with a big number of 
source datasets. The needed parameters are the raster dimensions, the size of the blocks and 
the data type. If the SourceProperties tag is not present, the source dataset will be opened 
at the same time as the VRT itself.

[...]

<SimpleSource>
<SourceFilename relativeToVRT="1">utm.tif</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="512" RasterYSize="512" DataType="Byte" BlockXSize="128" 
BlockYSize="128"/>
<SrcRect xOff="0" yOff="0" xSize="512" ySize="512"/>
<DstRect xOff="0" yOff="0" xSize="512" ySize="512"/>
</SimpleSource>
"""

Note: in theory, the VRT driver could be improved to implement this lazy opening behaviour 
without requiring SourceProperties, but until/if this is implemented some day, you have to 
use SourceProperties.

Even



> Hi,
> 
> Is there a way (or: what are the prerequisites) to avoid gdal opening
> all source files from a vrt on opening the vrt?
> 
> Context: I have created a large vrt, referencing many tif files. Both
> the vrt and tifs are remote (using /vsigs/). It works, but opening (e.g.
> running gdalinfo) is very slow.
> 
> I have a comparable vrt where the main difference is that it references
> .hgt files instead of tifs. Running gdalinfo on this vrt is almost
> instantaneous.
> 
> As there are no other significant differences otherwise, I wonder if
> this is because if the vrt machinery encounters a tif, it starts to
> check if there are any accompanying overviews (or other important
> metadata), while it does not do that for a .hgt file? Or is there a
> different reason? And how can I prevent this (without, preferably,
> changing to a different source file format)?
> 
> Thanks,
> Vincent.
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170828/55a96058/attachment.html>


More information about the gdal-dev mailing list