3

Is there a way to zoom further than the threshold allowed by a wmts feed? Of course the idea is not to download any more images as that would be impossible. I just want to zoom on the already downloaded images.

I'm using IGN's BDORTHO with the "pratique" key and as soon as I zoom further than some threshold (which strangely varies depending on the computer I'm using it on), the map goes blank instead of scaling the image.

  • Could you post the link of the WMTS? Because a quick test on some some other services in QGIS show that zooming in further than the highest detail level indeed shows the individual pixels instead of going blank. – LMB Aug 10 at 10:20
  • Sure. Paste this when creating a new service connection: wxs.ign.fr/pratique/geoportail/… – Gamnamno Aug 11 at 17:07
6
+25

This specific WMTS source has a small problem: not all reported scales have available tiles.

If you look at the capabilities document, the TileMatrix has 22 scales available (up to level 21) for the layer Photographies aériennes. QGIS will try to fetch tiles up to the level 21. That is what you have in the capabilities document.

If you install the QGIS Network Logger plugin, you can check for yourself that QGIS is able to fetch tiles up to level 19.

If you zoom more than that, QGIS will try to load new tiles from level 20, instead of scaling the tiles from level 19. But the server does not deliver tiles at level 20 and 21 (I've added a screenshot of the 404 errors). Maybe these levels are only available for authenticated users.

enter image description here

If the capabilities reported just up to level 19, you would be able to zoom in and get pixelized tiles beyond that. But with this server, QGIS will try to fetch more detailed tiles, instead of zooming the previous ones.

Workaround

You can use MapProxy to provide a WMTS service with just the scales you are able to get from IGN.

The result will be a WMTS server providing the correct metadata to QGIS. After level 19, QGIS will scale the image, as you can see in the image below.

enter image description here

To configure MapProxy, you have to provide the list of scales, without the last two. You can get the scales from the capabilities or from IGN documentation.

The configuration will include:

layers:
- name: photographiesaeriennes
  title: Photographies aériennes
  sources:
  - ign_cache
caches:
  ign_cache:
    grids:
    - ign_grid
    sources:
    - ign_source
sources:
  ign_source:
    type: tile
    grid: ign_grid
    url: https://wxs.ign.fr/pratique/geoportail/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&STYLE=normal&FORMAT=image/jpeg&TILEMATRIXSET=PM&TILEMATRIX=%(z)s&TILEROW=%(y)s&TILECOL=%(x)s
grids:
  ign_grid:
    base: GLOBAL_MERCATOR
    srs: EPSG:3857
    origin: nw
    res:
    - 156543.0339280410
    - 78271.5169640205
    - 39135.7584820102
    - 19567.8792410051
    - 9783.9396205026
    - 4891.9698102513
    - 2445.9849051256
    - 1222.9924525628
    - 611.4962262814
    - 305.7481131407
    - 152.8740565704
    - 76.4370282852
    - 38.2185141426
    - 19.1092570713
    - 9.5546285356
    - 4.7773142678
    - 2.3886571339
    - 1.1943285670
    - 0.5971642835
    - 0.2985821417

I've tested this MapProxy configuration and it works. The exercise should be improved to handle all layers and different girds, if you need so.

  • QGIS will trust the metadata sent by the server. If you inspect the project source, QGIS will not save the original layer properties, like available scales. QGIS saves the capabilities URL and next time you open the project, it will fetch the capabilities again. So, there is no way to limit the zoom levels QGIS will fetch from the server. – jgrocha Aug 12 at 21:09
  • 1
    You can install MapProxy, for example, to provide a new WMTS service to QGIS, limiting the scales up to level 19. The source of the service will be the original IGN WMTS service. That's one of the nice things MapProxy can do. – jgrocha Aug 12 at 21:18
  • Thanks. I finally got something working but it's very slow and I'm not sure I did it right. I asked about it in a separate question: gis.stackexchange.com/questions/332317/… – Gamnamno Aug 18 at 21:47

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.