0

I'm trying to create a WMTS service showing an orthophotography. I've build the tiles with gdal2tiles (https://gdal.gloobe.org/gdal/gdal2tiles.html) and it seems to be ok as i can see the tile in the viewer (leaflet.html) automatically generate by

gdal2tiles -s EPSG:2154 -z 16-21 Z:/01_A43/04_RASTER/ORTHO/952500-6500500
.tif C:/ORTHO_TILES

The result of such command is a repository (ORTHO_TILES) containing sub-directories (Zoom Level, 16 --> 21) containing sub--directories (referred to X in the world grid), containing tiles which have the name of the Y reference in the world grid.

example : C:/ORTHO_TILES/18/135615/168420.png

looks like this

example

then i try to visualise this in QGIS with an .xml file. I wrote it as it's specified in http://www.gdal.org/frmt_wms.html

 <GDAL_WMS>
  <Service name="TMS">
    <ServerUrl>file://C:/ORTHO_TILES/${z}/${x}/${y}.png</ServerUrl>
  </Service>
  <DataWindow>
   <UpperLeftX>-20037508.34</UpperLeftX>
   <UpperLeftY>20037508.34</UpperLeftY>
   <LowerRightX>20037508.34</LowerRightX>
   <LowerRightY>-20037508.34</LowerRightY>
   <TileLevel>21</TileLevel>
   <TileCountX>1</TileCountX>
   <TileCountY>1</TileCountY>
   <YOrigin>top</YOrigin>
  </DataWindow>
  <Projection>EPSG:3857</Projection>
  <BlockSizeX>256</BlockSizeX>
  <BlockSizeY>256</BlockSizeY>
  <BandsCount>4</BandsCount> 
  <Cache />
</GDAL_WMS>

The layer is load in QGIS but nothing appears in the canvas...

In the past, i'va done similary tricks using QTiles to create the TMS repositories and it worked well. I don't understand why with gdal2tiles it's different.

As QGIS doesn't push any error message and a I can zoom on the extent of the layer, it seems that QGIS recognize the xml as a raster without issues.

i have already read this question but there is no answer that worked for me here

gdal2tiles and qgis

2

Answer to myself after a few digging in TMS standard. The YOrigin of this protocol is bottom and not top...

so the following actually works:

<GDAL_WMS>
  <Service name="TMS">
    <ServerUrl>file://ORTHO_TILES/${z}/${x}/${y}.png</ServerUrl>
  </Service>
  <DataWindow>
    <UpperLeftX>-20037508.34</UpperLeftX>
    <UpperLeftY>20037508.34</UpperLeftY>
    <LowerRightX>20037508.34</LowerRightX>
    <LowerRightY>-20037508.34</LowerRightY>
    <TileLevel>21</TileLevel>
    <TileCountX>1</TileCountX>
    <TileCountY>1</TileCountY>
    <YOrigin>bottom</YOrigin>
  </DataWindow>
  <Projection>EPSG:3857</Projection>
  <BlockSizeX>256</BlockSizeX>
  <BlockSizeY>256</BlockSizeY>
  <BandsCount>4</BandsCount> 
  <Cache />
  • Good that you solved the issue but I wonder why do you want to look local orthophotos with QGIS through TMS. – user30184 Jun 26 '17 at 15:19
  • For now it's just to test the different software, but at the end the goal is to put all this on a server and give an access to this tiles with QGIS Server and Lizmap. Using WMTS is necessary as the original files are in a tif format and represents 12.4Gb of data (pixels are 10cm by 10cm) – YoLecomte Jun 26 '17 at 15:23
  • Makes sense now. – user30184 Jun 26 '17 at 15:24

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.