[gdal-dev] gdal2tiles error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] gdal2tiles error

Mutlu Ozdogan
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

Mutlu..


('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>
    gdal2tiles.process()
  File "/Library/Frameworks/GDAL.framework/Versions/Current/Programs/gdal2tiles.py", line 488, in process
    self.generate_base_tiles()
  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: [hidden email]





_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: gdal2tiles error

Grégory Bataille
Hello,

In your stack trace I gather you are using GDAL 1?
If that's the case, you should use the latest gdal 2.2). I'm quite sure the issue is fixed there

On a mac, look for the osgeo4mac brew tap and install the gdal2 package. I think it's up-to-date. Otherwise you should retrieve gdal2tiles.py from our github mirror.

On Wed, 23 Aug 2017 at 23:04, MUTLU OZDOGAN <[hidden email]> wrote:
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

Mutlu..


('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>
    gdal2tiles.process()
  File "/Library/Frameworks/GDAL.framework/Versions/Current/Programs/gdal2tiles.py", line 488, in process
    self.generate_base_tiles()
  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: [hidden email]




_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Greg

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev