gdal2tiles giving "Error 5" during tile generation

1,377 views
Skip to first unread message

Marianne

unread,
Nov 17, 2010, 7:52:37 PM11/17/10
to MapTiler User Group
Hi all,

Am trying to generate tiles from ascii grid data file to using in
openlayers as overlay over google baselayer.
This is want we are going:

gdalwarp -srcnodata -9999 -dstalpha datafile.asc gdal_alphafile.tif
gdal_translate -ot Byte -of GTiff -co "TILED=YES" -b 1 -b 1 -b 1 -b 2 -
scale gdal_alphafile.tif gdal_alphabytefile.tif

gdalwarp -t_srs epsg:900913 gdal_alphabytefile.tif projectedfile.tif
gdal2tiles.py -v -p mercator -s epsg:900913 -z "2-4"
projectedfile.tif tiles/

which outputs:

('Options:', <Values at 0x2b61c7e23248: {'profile': 'mercator', 'kml':
False, 'verbose': True, 'copyright': '', 'resume': False, 'url': '',
'googlekey': 'INSERT_YOUR_KEY_HERE', 'webviewer': 'all', 'yahookey':
'INSERT_YOUR_YAHOO_APP_ID_HERE', 'zoom': '2-4', 'resampling':
'average', 'title': 'projectedfile.tif', 'srcnodata': None, 's_srs':
'epsg:900913'}>)
('Input:', 'projectedfile.tif')
('Output:', './t900913/')
Cache: 40 MB

('Input file:', '( 720P x 280L - 4 bands)')
NODATA: []
('Preprocessed file:', '( 720P x 280L - 4 bands)')
('Bounds (output srs):', -180.0, -56.0, 180.0, 84.0)
('Bounds (latlong):', (-0.00050305655909565377,
-0.0016169675114151385), (0.00075458483864348071,
0.0016169675114151385))
('MinZoomLevel:', 2)
('MaxZoomLevel:', 4, '(', 9783.9396205025605, ')')
Generating Base Tiles:

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

('dataBandsCount: ', 3)
('tilebands: ', 4)
(1, '/', 4, './t900913/4/7/8.png')
('\tNative Extent (querysize', 5009377, '): ', (0, 0, 360, 168),
(5009017, 5009209, 360, 168))
('\tReadRaster Extent: ', (0, 0, 360, 168), (1023, 1023, 1, 1))
(2, '/', 4, './t900913/4/8/8.png')
('\tNative Extent (querysize', 360, '): ', (360, 0, 360, 168), (0,
5009209, 360, 168))
('\tReadRaster Extent: ', (360, 0, 360, 168), (0, 1023, 0, 1))
ERROR 5: Illegal values for buffer size
ERROR 5: Illegal values for buffer size
ERROR 5: Illegal values for buffer size
ERROR 5: Illegal values for buffer size
(3, '/', 4, './t900913/4/7/7.png')
('\tNative Extent (querysize', 5009377, '): ', (0, 168, 360, 112),
(5009017, 0, 360, 112))
('\tReadRaster Extent: ', (0, 168, 360, 112), (1023, 0, 1, 0))
ERROR 5: Illegal values for buffer size
ERROR 5: Illegal values for buffer size
ERROR 5: Illegal values for buffer size
ERROR 5: Illegal values for buffer size
(4, '/', 4, './t900913/4/8/7.png')
('\tNative Extent (querysize', 360, '): ', (360, 168, 360, 112), (0,
0, 360, 112))
('\tReadRaster Extent: ', (360, 168, 360, 112), (0, 0, 0, 0))
ERROR 5: Illegal values for buffer size
ERROR 5: Illegal values for buffer size
ERROR 5: Illegal values for buffer size
ERROR 5: Illegal values for buffer size
Generating Overview Tiles:
(1, '/', 8, './t900913/3/3/4.png')
('\tbuild from zoom', 4, ' tiles:', (6, 8), (7, 8), (6, 9), (7, 9))
(2, '/', 8, './t900913/3/4/4.png')
('\tbuild from zoom', 4, ' tiles:', (8, 8), (9, 8), (8, 9), (9, 9))
(3, '/', 8, './t900913/3/3/3.png')
('\tbuild from zoom', 4, ' tiles:', (6, 6), (7, 6), (6, 7), (7, 7))
(4, '/', 8, './t900913/3/4/3.png')
('\tbuild from zoom', 4, ' tiles:', (8, 6), (9, 6), (8, 7), (9, 7))
(5, '/', 8, './t900913/2/1/2.png')
('\tbuild from zoom', 3, ' tiles:', (2, 4), (3, 4), (2, 5), (3, 5))
(6, '/', 8, './t900913/2/2/2.png')
('\tbuild from zoom', 3, ' tiles:', (4, 4), (5, 4), (4, 5), (5, 5))
(7, '/', 8, './t900913/2/1/1.png')
('\tbuild from zoom', 3, ' tiles:', (2, 2), (3, 2), (2, 3), (3, 3))
(8, '/', 8, './t900913/2/2/1.png')
('\tbuild from zoom', 3, ' tiles:', (4, 2), (5, 2), (4, 3), (5, 3))

If I change the gdalwarp line to warp to epsg:4326 it all works fine
but the overlay doesn't seem to line up with the google map base
layer.

Any help would be appreciated.

Chris Dunphy

unread,
Dec 30, 2010, 9:20:34 PM12/30/10
to MapTiler User Group
Did you ever get any help understanding the "ERROR 5: Illegal values
for buffer size" message?

I'm using gdal2tiles to process a .png map file. It works just fine
on the 12288 × 7168 version of the map, but I get a multitude of
"ERROR 5" messages when I try to process the exact same .png saved at
6144 × 3584.

This is the command I am using: "gdal2tiles.py --s_srs=epsg:900913
map.png"

Here are the .aux.xml files for each .png:

<PAMDataset>
<GeoTransform> -1.4401959121379767e+07, 6.1149622628140980e+02,
0.0000000000000000e+00, 6.8878934928338043e+06, 0.0000000000000000e
+00, -6.1149622628141049e+02</GeoTransform>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="INTERLEAVE">PIXEL</MDI>
</Metadata>
</PAMDataset>

<PAMDataset>
<GeoTransform> -1.4401959121379800e+07, 1.2229924525628255e+03,
0.0000000000000000e+00, 6.8878934928337997e+06, 0.0000000000000000e
+00, -1.2229924525628210e+03</GeoTransform>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="INTERLEAVE">PIXEL</MDI>
</Metadata>
</PAMDataset>

Any ideas? I haven't had any problems with gdal2tiles for the past
month, and now this has suddenly derailed me.

I'm completely stuck - any help at all is appreciated.

- Chris // www.technomadia.com

Chris Dunphy

unread,
Dec 30, 2010, 11:20:18 PM12/30/10
to MapTiler User Group
I've been doing a lot of digging, and I think I am onto something.

The image I am having problems with is 6144 × 3584. If I resize that
image to 6145 x 3585 and use the same aux.xml, I have no problems.
Looking at the tiles that are generating the error, the seem to be the
edge tiles that are essentially empty and off the edge of the map.

I think there is some sort of rounding or off-by-one error at work
under the hood here, but I don't know enough Python to debug any
further.

That said - other than the flood of scary error messages, I think the
resulting dataset is just fine. At least it seems so at the
moment....

- Chris // www.technomadia.com
Reply all
Reply to author
Forward
0 new messages