0

I'm trying to display a WMTS from https://wmts.geo.admin.ch/EPSG/2056/1.0.0/WMTSCapabilities.xml with mapproxy, but I have some trouble to get the restful_template of the wmts service in Mapproxy right.

In the capabilities.xml of the official WMTS source I can read the following url:

<ResourceURL format="image/jpeg" resourceType="tile" template="https://wmts.geo.admin.ch/1.0.0/ch.swisstopo.swissimage/default/{Time}/2056/{TileMatrix}/{TileCol}/{TileRow}.jpeg"/>

But as I could see, the parameter {Time} is not known in Mapproxy. And the {TileMatrixSet} is also missing in the url given by the capabilities.)

I had to add the {TileMatrixSet} in to the restful_template of the service,as mapproxy wouldn't start without it. (https://mapproxy.org/docs/1.13.1/services.html#web-map-tile-services-wmts)

This gave me following mapproxy.yaml

services:
  wmts:
    restful: true
    kvp: true
    restful_template: /1.0.0/{Layer}/default/{TileMatrixSet}/2056/{TileMatrix}/{TileCol}/{TileRow}.{Format}
  
sources:

  swisstopo: 
    type: tile
    grid: current
    url : https://wmts.geo.admin.ch/1.0.0/ch.swisstopo.swissimage/default/current/2056/%(z)s/%(y)s/%(x)s.%(format)s
      
layers:
  - name: ch.swisstopo.swissimage
    title: ch.swisstopo.swissimage
    sources: [test_wms_cache]
      
    
caches:
  test_wms_cache:
    sources: [swisstopo]
    grids: [current]
    #meta_size: [2, 2]
    format: image/jpeg
    
grids:
  current:
    srs: 'EPSG:2056'
    bbox: [2420000.0, 1030000.0, 2900000.0, 1350000.0]
    bbox_srs: 'EPSG:2056'
    origin: nw
    res: [4000,3750,3500,3250,3000,2750,2500,2250,2000,1750,1500,1250,1000,750,650,500,250,100,50,20,10,5,2.5,2,1.5,1,0.5,0.25,0.1]

As I was missing a TileMatrixSet, I named my grid after it (current). As a result I tried to request 2 times the same tile, once in the original resource, once in mapproxy. But the result aren't the same tiles:

Origninal Tile Request

Original Tile

Mapproxy tile request

Mapproxy Tile

I guess the diffrence of location is because of the {Tilematrixset} parameter, but I don't know how to handle this correctly.

Gladly I will try out any suggestions, I can feel like it's just a step away from working.

2 Answers 2

1

My first thought was wrong. I try another one ;) since I stumbled around with swisstopo services too these days.

your URL

https://wmts.geo.admin.ch/1.0.0/ch.swisstopo.swissimage/default/current/2056/%(z)s/%(y)s/%(x)s.%(format)s

has wrong order of x and y you should try

https://wmts.geo.admin.ch/1.0.0/ch.swisstopo.swissimage/default/current/2056/%(z)s/%(x)s/%(y)s.%(format)s

Cheers

0

I think you misconfigured you BBOX.

[2420000.0, 1030000.0, 2900000.0, 1350000.0]

should be

[2420000.0, 130000.0, 2900000.0, 1350000.0]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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