1

I created a TMS using gdal2tiles command. The tiles where generated correctly and I can see them using the leaflet and openlayers html pages also created by gdal2tiles. Now, I'm trying to open the TMS in QGIS, using gdal and the TMS mini driver.

I created the xml file describing the TMS but when I load it in QGIS, I get a blank screen with some random colored pixels on the top part of the screen. Any Idea what could be wrong? I'm using QGIS 2.18.0, 64bis from OsGeo4W (windows 10).

Bellow is my XML file:

<GDAL_WMS>
<Service name="TMS">
    <ServerUrl>./${z}/${x}/${y}.png</ServerUrl>
    <ImageFormat>image/png</ImageFormat>
</Service>
<DataWindow>
    <UpperLeftX>-20037508.34</UpperLeftX>
    <UpperLeftY>20037508.34</UpperLeftY>
    <LowerRightX>20037508.34</LowerRightX>
    <LowerRightY>-20037508.34</LowerRightY>
    <TileLevel>14</TileLevel>
    <TileCountX>1</TileCountX>
    <TileCountY>1</TileCountY>
    <YOrigin>top</YOrigin>
</DataWindow>
<Projection>EPSG:3857</Projection>
<BlockSizeX>256</BlockSizeX>
<BlockSizeY>256</BlockSizeY>
<BandsCount>4</BandsCount>
<DataType>byte</DataType>
<ZeroBlockHttpCodes>204,303,400,404,500,501</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>
<Cache/>
</GDAL_WMS>
  • Any reason not to use the native tms provider introduced in 2.18? – ndawson Nov 24 '16 at 18:50
  • @ndawson Tried it, with no success. Does it work with file:/// protocol, or is a local server necessary to use http://localhost? – AndreJ Nov 24 '16 at 19:02
  • @AndreJ, the last line was </GDAL_WMS>. I missed that line when I copyed the code. Fixed it in the question – Daniel Nov 24 '16 at 19:03
  • @ndawson I was not aware there was a native TMS provider. Just found it in the Browser Panel. I'm regenerating the TMS and will give it a go when it finishes. – Daniel Nov 24 '16 at 19:06
  • @ndawson I could not get the native TMS provider to work. Tried it using file:///+full path or without the file:///. I'm seeing lots of Tile request max retry error. Failed 3 requests for tile 13 of tileRequest 2 (url: file:///I/SUL/rapid_tms_utm21/6/19/38.png in the log panel. Will open a new question about the issue. – Daniel Nov 25 '16 at 11:02
0

It might be necessary to add a protocol (http://localhost/ or file:///) to the serviceURL. See GDAL TMS (WMS) mini driver for an example.

As an alternative, you can use the TileLayer plugin, which can deal with local tiles with this syntax:

 myMapnik   myMapnik    file:///F:/Tiles/myMapnik/{z}/{x}/{y}.png   1   0   15  -180    -85.0   180.0   85.0

The plugin expects a file with TAB delimiters.

  • Adding the protocol did not work. Tried using both relative and full paths for the file location. however, i was able to make it work using the TileLayer plugin! Thanks – Daniel Nov 24 '16 at 17:50
  • The syntax might be OS-dependent. It works for me on Windows with the linked example. – AndreJ Nov 24 '16 at 18:54
  • GDAL driver as far as I know does not support reading local tiles directly from file system. If you had a http server running in local host it should work but it is a bit heavy workaround. – user30184 Nov 25 '16 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.