[gdal-dev] gdal2tiles 3.11.3 dies when source files have transparency

Stefan Gofferje lists at home.gofferje.net
Mon Sep 29 08:41:48 PDT 2025


Hi all,

I have 4 large GeoTIFF files from which I want to create XYZ tiles. I 
have tried various combinations with gdal_merge, gdalbuildvrt and 
gdal_translate and the result is the same:

When the source file contains transparency such as

gdalbuildvrt -srcnodata 0 VVVH.vrt ${LIST}
gdal_merge -n 0 -a_nodata 0 -o VVVH.tif ${LIST}

etc...

gdal2tiles dies complaining that the source file cannot be found in the 
/tmp directory.

I call gdal2tiles like this:
/usr/bin/gdal2tiles -x --processes 8 --xyz -z 8-14 VVVH.vrt tiles
or
/usr/bin/gdal2tiles -x --processes 8 --xyz -z 8-14 VVVH.tif tiles
depending on what source file I created.

I really would like to have tiles which are transparent where the source 
files are instead of black.

Example output:

0multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
   File "/usr/lib/python3.12/multiprocessing/pool.py", line 125, in worker
     result = (True, func(*args, **kwds))
                     ^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3.12/multiprocessing/pool.py", line 48, in mapstar
     return list(map(*args))
            ^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/osgeo_utils/gdal2tiles.py", line 
1335, in create_base_tile
     alpha = alphaband.ReadRaster(rx, ry, rxsize, rysize, wxsize, wysize)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/osgeo/gdal.py", line 8756, in 
ReadRaster
     return _gdal.Band_ReadRaster1(self, xoff, yoff, xsize, ysize,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: /tmp/tmpg8iuy420/VVVH.tif: No such file or directory
May be caused by: /tmp/tmpg8iuy420/VVVH.tif: No such file or directory
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
   File "/usr/bin/gdal2tiles", line 33, in <module>
     sys.exit(load_entry_point('GDAL==3.11.3', 'console_scripts', 
'gdal2tiles')())
  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/osgeo_utils/gdal2tiles.py", line 
4625, in main
     return submain(argv, called_from_main=called_from_main)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/osgeo_utils/auxiliary/util.py", 
line 46, in enable_exceptions_wrapper
     return fun(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/osgeo_utils/gdal2tiles.py", line 
4655, in submain
     multi_threaded_tiling(input_file, output_folder, options, pool)
   File "/usr/lib/python3/dist-packages/osgeo_utils/auxiliary/util.py", 
line 46, in enable_exceptions_wrapper
     return fun(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/osgeo_utils/gdal2tiles.py", line 
4549, in multi_threaded_tiling
     for _ in pool.imap_unordered(
   File "/usr/lib/python3.12/multiprocessing/pool.py", line 451, in 
<genexpr>
     return (item for chunk in result for item in chunk)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3.12/multiprocessing/pool.py", line 873, in next
     raise value
RuntimeError: /tmp/tmpg8iuy420/VVVH.tif: No such file or directory
May be caused by: /tmp/tmpg8iuy420/VVVH.tif: No such file or directory



-- 
  (o_   Stefan Gofferje            | SCLT, MCP, CCSA
  //\   Reg'd Linux User #247167   | VCP #2263
  V_/_  https://www.gofferje.net   | https://www.saakeskus.fi



More information about the gdal-dev mailing list