[gdal-dev] gdal2tiles error

MUTLU OZDOGAN ozdogan at wisc.edu
Wed Aug 23 13:03:36 PDT 2017

Dear developers,

I have an 8-bit geotiff image that contains land cover classification results.  The dimensions of the image is 1000 x 1000 pixels.  I am trying to generate tiles with 21 zoom levels using the gdal2tiles.py script so that we can display the results on a website.  In the first step, I converted the single band paletted image into color composite with the correct class colors using this command:

gdal_translate -of vrt -expand rgba results.tif temp.vrt

and in the second step I used the gdal2tiles.py script in the following way but I am getting errors:

gdal2tiles.py -p raster -z 0-20 -a 3 -v temp.vrt sample

the error is below.

Any help in explaining and solving this issue would be much appreciated.

Thank you


('Input file:', '( 1000P x 1000L - 4 bands)')
NODATA: [3.0, 3.0, 3.0, 3.0]
('Preprocessed file:', '( 1000P x 1000L - 4 bands)')
KML autotest OK!
('Bounds (output srs):', -96.08910285, 42.692523704760006, -95.81960826476, 42.96201829)
('Native zoom of the raster:', 2)
Generating Base Tiles:

Tiles generated from the max zoom level:

('dataBandsCount: ', 3)
('tilebands: ', 4)
(1, '/', 1048576000000, 'sample/20/0/1023999.png')
('\tReadRaster Extent: ', (0, -1023000, 1, 1), (0, 0, 256, 256))
ERROR 5: temp.vrt: Access window out of range in RasterIO().  Requested
(0,-1023000) of size 1x1 on raster of 1000x1000.
ERROR 5: temp.vrt, band 4: Access window out of range in RasterIO().  Requested
(0,-1023000) of size 1x1 on raster of 1000x1000.
Traceback (most recent call last):
  File "/Library/Frameworks/GDAL.framework/Versions/Current/Programs/gdal2tiles.py", line 2278, in <module>
  File "/Library/Frameworks/GDAL.framework/Versions/Current/Programs/gdal2tiles.py", line 488, in process
  File "/Library/Frameworks/GDAL.framework/Versions/Current/Programs/gdal2tiles.py", line 1276, in generate_base_tiles
    dstile.WriteRaster(wx, wy, wxsize, wysize, data, band_list=list(range(1,self.dataBandsCount+1)))
  File "/Library/Frameworks/GDAL.framework/Versions/1.11/Python/2.7/site-packages/osgeo/gdal.py", line 846, in WriteRaster
    buf_pixel_space, buf_line_space, buf_band_space )
TypeError: not a string


Mutlu Ozdogan, Ph.D.
Associate Professor
Department of Forest and Wildlife Ecology &
Nelson Institute for Environmental Studies
t: (608) 262-0873
e: ozdogan at wisc.edu<mailto:ozdogan at wisc.edu>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170823/38c75970/attachment.html>

More information about the gdal-dev mailing list