Hey Stefan,
I don't have a direct answer to your question. But, I noticed you are
using gdal 3.11.3. I would encourage you to try the gdal cli version. It
doesn't rely on python and has a whole bunch of options. Something like:
echo "Creating complete.gdalg.json..."
gdal raster mosaic \
--input="cache/*.tif" \
--output="complete.gdalg.json" \
--resolution=highest \
--overwrite
echo "Creating tiles..."
gdal raster tile \
--input=complete.gdalg.json \
--min-zoom=12 --max-zoom=14 \
--skip-blank --overview-resampling=cubic \
--co ZLEVEL=9 --add-alpha \
--output=tilesDir \
--progress
Documentation can be found here:
https://gdal.org/en/stable/programs/gdal_raster_tile.html#gdal-raster-tile
Hope that helps!
Scott
On 9/29/25 08:41, Stefan Gofferje via gdal-dev wrote:
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
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev