[GIS] gdal2tiles.py problem – creating mini tiles

gdalgdal2tilesgdalbuildvrttiles

I have a similar problem to the issue posted here (gdal2tiles problem).

I have 80 GeoTIFFs (4000×4000) with EPSG:27700 projection embedded and TFW and PRJ files. These I have built into a virtual raster using gdalbuildvrt which creates a 10×10 tile image that is 40000×40000 pixels.

Using gdal2tiles I can create a set of tiles for specific zoom levels. In this case I am using the Ordnance Survey VectorMap District and 25K raster tiles and I want zoom levels 7, 8 and 9. The problem is that zoom levels 8 and 9 work perfectly creating 97969 tiles at zoom level 9 and 24649 tiles at zoom level 8. Zoom level 7 creates the correct number of tiles but the output images consist of a "mini" thumbnail in the top left corner and the rest of the image is transparent/white.

Why does it work for 8 and 9 and not 7?
Should I resize the image to fit nicely into 256×256 squares?

See the images attached below:

Zoom level 7

Zoom level 8

Best Answer

I just ran into this same/similar problem. What fixed my problem was to make the image large enough for the gdal2tiler to make proper tiles. I made my image evenly divisible by 256px, so this may have be necessary as well.

I initially had a 16128px wide image and was trying to create zoom levels between 0-7. The gdal2tiler worked as expected when I tiled the 16128px image at zoom levels of 0-6, but created the "mini tiles" problem when trying to create 7 zoom levels out of the 16128px image. I generated the image to a new size of 32000px. The gdal2tiler worked properly when running the 32000px image with 0-7 zoom levels.