<div><div dir="auto">Hello,</div><div dir="auto"><br></div><div dir="auto">In your stack trace I gather you are using GDAL 1?</div><div dir="auto">If that's the case, you should use the latest gdal 2.2). I'm quite sure the issue is fixed there</div><div dir="auto"><br></div><div dir="auto">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.</div><br><div class="gmail_quote"><div>On Wed, 23 Aug 2017 at 23:04, MUTLU OZDOGAN <<a href="mailto:ozdogan@wisc.edu">ozdogan@wisc.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word">
Dear developers,
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<div>gdal_translate -of vrt -expand rgba results.tif temp.vrt</div>
<div><br>
</div>
<div>and in the second step I used the gdal2tiles.py script in the following way but I am getting errors:</div>
<div><br>
</div>
<div>gdal2tiles.py -p raster -z 0-20 -a 3 -v temp.vrt sample</div>
<div><br>
</div>
<div>the error is below.  </div>
<div><br>
</div>
<div>Any help in explaining and solving this issue would be much appreciated.</div>
<div><br>
</div>
<div>Thank you</div>
<div><br>
</div>
<div>Mutlu..</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>('Input file:', '( 1000P x 1000L - 4 bands)')</div>
<div>NODATA: [3.0, 3.0, 3.0, 3.0]</div>
<div>('Preprocessed file:', '( 1000P x 1000L - 4 bands)')</div>
<div>KML autotest OK!</div>
<div>('Bounds (output srs):', -96.08910285, 42.692523704760006, -95.81960826476, 42.96201829)</div>
<div>('Native zoom of the raster:', 2)</div>
<div>Generating Base Tiles:</div>
<div><br>
</div>
<div>Tiles generated from the max zoom level:</div>
<div>----------------------------------------</div>
<div><br>
</div>
<div>('dataBandsCount: ', 3)</div>
<div>('tilebands: ', 4)</div>
<div>(1, '/', 1048576000000, 'sample/20/0/1023999.png')</div>
<div>('\tReadRaster Extent: ', (0, -1023000, 1, 1), (0, 0, 256, 256))</div>
<div>ERROR 5: temp.vrt: Access window out of range in RasterIO().  Requested</div>
<div>(0,-1023000) of size 1x1 on raster of 1000x1000.</div>
<div>ERROR 5: temp.vrt, band 4: Access window out of range in RasterIO().  Requested</div>
<div>(0,-1023000) of size 1x1 on raster of 1000x1000.</div>
<div>Traceback (most recent call last):</div>
<div>  File "/Library/Frameworks/GDAL.framework/Versions/Current/Programs/gdal2tiles.py", line 2278, in <module></div>
<div>    gdal2tiles.process()</div>
<div>  File "/Library/Frameworks/GDAL.framework/Versions/Current/Programs/gdal2tiles.py", line 488, in process</div>
<div>    self.generate_base_tiles()</div>
<div>  File "/Library/Frameworks/GDAL.framework/Versions/Current/Programs/gdal2tiles.py", line 1276, in generate_base_tiles</div>
<div>    dstile.WriteRaster(wx, wy, wxsize, wysize, data, band_list=list(range(1,self.dataBandsCount+1)))</div>
<div>  File "/Library/Frameworks/GDAL.framework/Versions/1.11/Python/2.7/site-packages/osgeo/gdal.py", line 846, in WriteRaster</div>
<div>    buf_pixel_space, buf_line_space, buf_band_space )</div>
<div>TypeError: not a string</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>-- <br>
<div>
<div>
<pre class="m_3393114687523190033moz-signature" cols="72">Mutlu Ozdogan, Ph.D.
Associate Professor
Department of Forest and Wildlife Ecology &
Nelson Institute for Environmental Studies
t: (608) 262-0873
e: <a class="m_3393114687523190033moz-txt-link-abbreviated" href="mailto:ozdogan@wisc.edu" target="_blank">ozdogan@wisc.edu</a></pre>
<div><br>
</div>
</div>
<div><br>
</div>
<br class="m_3393114687523190033Apple-interchange-newline">
</div>
<br>
</div>
</div>

_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></blockquote></div></div><div dir="ltr">-- <br></div><div class="gmail_signature" data-smartmail="gmail_signature">Greg</div>