Several years ago I created multiple tiles (xyz) from orthophotomaps using GDAL with success but now I'm getting this error and I don't know what I'm doing wrong.

This is the error:

Traceback (most recent call last):
File "gdal2tiles.py", line 2903, in <module>
File "gdal2tiles.py", line 2897, in main
single_threaded_tiling(input_file, output_folder, options)
File "gdal2tiles.py", line 2831, in single_threaded_tiling
conf, tile_details = worker_tile_details(input_file, output_folder, options)
File "gdal2tiles.py", line 2751, in worker_tile_details
File "gdal2tiles.py", line 1468, in open_input
in_srs, self.in_srs_wkt = setup_input_srs(input_dataset, self.options)
File "gdal2tiles.py", line 705, in setup_input_srs
File "/usr/lib/python3/dist-packages/osgeo/osr.py", line 297, in <lambda>
__getattr__ = lambda self, name: _swig_getattr(self, SpatialReference, name)
File "/usr/lib/python3/dist-packages/osgeo/osr.py", line 80, in _swig_getattr
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
AttributeError: 'SpatialReference' object has no attribute 'SetAxisMappingStrategy'

I have approx 100 TIFF files with world file for each one. I tried to do the following:

Create VRT file from TIFF files:

gdalbuildvrt -addalpha -a_srs EPSG:5514 tiles.vrt *.tif

Use GDAL warp:

gdalwarp -srcnodata 255,255,255 -dstnodata 0,0,0 -t_srs EPSG:5514 tiles.vrt output.tif

Create tiles:

gdal2tiles -s EPSG:5514 -z 15-16 output.tif tile_folder/

I tried different commands with different settings but still the same error. What am I doing wrong?

  • Could you install a bit older GDAL 2.x version and have a try with that? – user30184 Aug 5 '19 at 7:53

Thanks to user30184 I installed GDAL 2.4.2 instead of 3.x and now the command gdal2tiles run without error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.