2

I'm experiencing what seems to be a very particular issue when running gdal2tiles on a virtual raster at zoom levels 10 to 17. The function runs without issue for all zoom levels except for zoom level 16, where I receive an "ERROR 5: Illegal values for buffer size" error.

I'm using gdal2tiles version 2.1.3, and the command I'm using is nothing out of the ordinary:
gdal2tiles -s EPSG:3857 -z 16 georef\output.vrt tiles

I've run the function at various levels using a verbose command, and I believe the issue is related to the Native Extent being set to (0,0,0,611) for the first tile, which (I think) gives the tile a width of zero. The verbose output for zoom level 16 is shown below:

('Options:', <Values at 0x7f77e7661e60: {'profile': 'mercator', 'kml': False, 's_srs': 'EPSG:3857', 'copyright': '', 'resume': False, 'url': '', 'googlekey': 'INSERT_YOUR_KEY_HERE', 'bingkey': 'INSERT_YOUR_KEY_HERE', 'webviewer': 'all', 'zoom': '16', 'quiet': None, 'resampling': 'average', 'tmscompatible': None, 'title': 'output.vrt', 'srcnodata': None, 'verbose': True}>)
('Input:', 'output.vrt')
('Output:', 'tiles')
Cache: 395 MB

('Input file:', '( 91664P x 68298L - 3 bands)')
NODATA: []
('Preprocessed file:', '( 91664P x 68298L - 3 bands)')
('Bounds (output srs):', 0.0, -68298.0, 91664.0, 0.0)
('Bounds (latlong):', (-0.6135196480581518, 0.0), (0.0, 0.823431722035318))
('MinZoomLevel:', 16)
('MaxZoomLevel:', 16, '(', 2.388657133911758, ')')
Generating Base Tiles:

Tiles generated from the max zoom level:
----------------------------------------

('dataBandsCount: ', 3)
('tilebands: ', 4)
(1, '/', 16912, 'tiles/16/32767/32767.png')
('\tNative Extent (querysize', 611, '): ', (0, 0, 0, 611), (611, 0, 0, 611))
('\tReadRaster Extent: ', (0, 0, 0, 611), (1024, 0, 0, 1024))
ERROR 5: Illegal values for buffer size
ERROR 5: Illegal values for buffer size
Traceback (most recent call last):
  File "/usr/bin/gdal2tiles.py", line 2436, in <module>
    main()
  File "/usr/bin/gdal2tiles.py", line 2433, in main
    gdal2tiles.process()
  File "/usr/bin/gdal2tiles.py", line 481, in process
    self.generate_base_tiles()
  File "/usr/bin/gdal2tiles.py", line 1309, in generate_base_tiles
    dsquery.WriteRaster(wx, wy, wxsize, wysize, data, band_list=list(range(1,self.dataBandsCount+1)))
  File "/usr/lib/python2.7/dist-packages/osgeo/gdal.py", line 2000, in WriteRaster
    buf_pixel_space, buf_line_space, buf_band_space )
TypeError: not a string

As mentioned above, there are no errors experienced with other zoom levels, and verbose output for other levels shows a non-zero third argument to Native Extent and ReadRaster Extent.

For example for zoom level 15:

('dataBandsCount: ', 3)
('tilebands: ', 4)
(1, '/', 4256, 'tiles/15/16383/16383.png')
('\tNative Extent (querysize', 1223, '): ', (0, 0, 1, 1223), (1222, 0, 1, 1223))
('\tReadRaster Extent: ', (0, 0, 1, 1223), (1023, 0, 1, 1024))

I'm uncertain if this is a bug, or if I'm perhaps missing something with my configuration.

Your Answer

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

Browse other questions tagged or ask your own question.