[GIS] gdal2tiles and QGIS

gdalgdal2tilesqgistile-map-servicetiles

I have made a tile pyramid of a number of Dutch topographical maps using gdal2tiles. This gives apart from the tiles openlayers.html and tilemapresource.xml. The openlayers shows perfectly and correctly aligned with respect with the osm layer in a browser.

However, I would like to view them as a layer in QGIS. I have tried various things but to no avail. The nearest thing to something was using the tip in display tiles with no plugin inside QGIS. The example xml in web page works but when changing the server into file:///pdok/top25tiles/{z}/{x}/{y}.png I get an inconsistently colored screen. (I changed the projection to EPSG:3785 both in gdal2tiles.py and in the xml)

The gdal2tiles line is e.g.:

gdal2tiles3785.py -z 15 /pdok/TOP25raster_GEOTIFF/32-top25raster-2013.tif /pdok/top25tiles

QGIS is 2.4.0,
GDAL is 1.11.2,
Ubunto is 15.04

Best Answer

I display may self-tiled Dutch cadastral maps in QGIS with the TileLayers Plugin.

In the configuration file, you have to use tabs as delimiters:

Topo    Topo    file:///d:/Tiles/Topo/{z}/{x}/{y}.png   1   0   16  -180    -85.0   180.0   85.0

If you get strange-coloured tiles, you have to expand from paletted coloured source files to RGBA vrt files before starting the tiling:

for %%N in (D:\Karten\gdal\gdal2tiles\NL25\*.tif) DO gdal_translate -of vrt -expand rgba %%N D:\Karten\gdal\gdal2tiles\NL25\%%~nN.vrt
gdalbuildvrt -allow_projection_difference index25.vrt NL25\*.vrt
gdal2tiles --s_srs EPSG:28992 --zoom 15-16 index25.vrt tiles
pause