[gdal-dev] Limit on the number of files for gdalbuildvrt
Even Rouault
even.rouault at spatialys.com
Wed Oct 30 09:16:17 PDT 2019
On mercredi 30 octobre 2019 15:52:54 CET Jose Gomez-Dans wrote:
> Hi,
>
> I'm mosaicking a large number of small tiles using the GDAL python bindings
> (python 3.7, gdal 3.0.1, but also tested on 2.4.2). Code is something like
>
> ```
>
> *output_fname = "/something/or/other.vrt"*
> *fnames = ["file1.tif", ..., "fileN.tif"]*
>
>
>
>
> *dst_ds = gdal.BuildVRT( output_fname, fnames,
> options=gdal.BuildVRTOptions(separate=True), )*
> *dst_ds = None*
> ```
>
> This fails with lots of errors like
> ERROR 4: fileXXX.tif: No such file or directory
> Warning 1: Can't open fileXXX.tif. Skipping it
gdalbuildvrt is normally cautious about non opening too many files at the same
time. I can't replicate your issue with the following script
```
from osgeo import gdal
import shutil
fnames = []
for i in range(1024):
dstname = 'testbuildvrt/byte%d.tif' % i
shutil.copy('byte.tif', dstname)
fnames.append(dstname)
dst_ds = gdal.BuildVRT(
"/tmp/out.vrt",
fnames,
options=gdal.BuildVRTOptions(separate=True),
)
dst_ds = None
```
> The aim of this is to create a VRT mosaic that can then be converted to
> GeoTIFF.
If you want a mosaic, you likely want separate=False.
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list