[MapProxy] Problems with WMTS grid configuration

Travis Kirstine traviskirstine at gmail.com
Tue Jun 4 05:47:28 PDT 2019


Hey Matthias,

Not really sure what the issue is - maybe you need to specify the tile_size
in the grid or the on_error in the source?
I've included a sample of what worked for me for the following WMTS - hope
it helps.

https://www.toronto.ca/city-government/data-research-maps/open-data/open-data-catalogue/#b2d79926-bce9-989c-390b-7ff5247b6515


grids:
   spherical_mercator:
      srs: EPSG:3857
      res_factor: 2
      num_levels: 22
      bbox: [-20037508, -20037508, 20037508, 20037508]
      bbox_srs: EPSG:3857
      tile_size: [256,256]
      origin: sw
   GoogleMapsCompatible:
      origin: nw
      bbox: [-20037508, -20037508, 20037508, 20037508]
      bbox_srs: EPSG:3857
      tile_size: [256,256]
      srs: EPSG:3857
      res: [
           #  res            level     scale @90.7 DPI
         156543.0339280410, #  0   559082264.02871776
          78271.5169640205, #  1   279541132.01435888
          39135.7584820102, #  2   139770566.00717941
          19567.8792410051, #  3    69885283.00358970
           9783.9396205026, #  4    34942641.50179486
           4891.9698102513, #  5    17471320.75089743
           2445.9849051256, #  6     8735660.37544871
           1222.9924525628, #  7     4367830.18772436
            611.4962262814, #  8     2183915.09386218
            305.7481131407, #  9     1091957.54693109
            152.8740565704, # 10      545978.77346554
             76.4370282852, # 11      272989.38673277
             38.2185141426, # 12      136494.69336639
             19.1092570713, # 13       68247.34668319
              9.5546285356, # 14       34123.67334160
              4.7773142678, # 15       17061.83667080
              2.3886571339, # 16        8530.91833540
              1.1943285670, # 17        4265.45916770
              0.5971642835, # 18        2132.72958385
      ]

#######################

sources:
   toronto_1978_wmts:
      type: tile
      url: '
https://gis.toronto.ca/arcgis/rest/services/basemap/cot_historic_aerial_1978/MapServer/WMTS/tile/1.0.0/basemap_cot_historic_aerial_1978/default/GoogleMapsCompatible/%(z)s/%(y)s/%(x)s
'
      grid: GoogleMapsCompatible
      transparent: true
      on_error:
         404:
            response: transparent
            cache: false
      coverage:
         datasource: "PG: dbname='db' host='foobar' user='usr''
password='pw'"
         where: 'SELECT boundary_3857 FROM layers WHERE id = 379'
         srs: 'EPSG:3857'
##############################

caches:
   toronto_1978_cache:
      grids: [GoogleMapsCompatible, spherical_mercator]
      sources: [toronto_1978_wmts]
      bulk_meta_tiles: true
      cache:
        type: sqlite
        directory: /opt/caches/sqlite/toronto_1978_cache

#################################

layers:
         - name: toronto_1978
           title: City of Toronto 1978
           sources: [toronto_1978_cache]





On Mon, 3 Jun 2019 at 11:44, Matthias Woltering <woltering at gmail.com> wrote:

> Hi all,
>
> I have problems creating the correct mapproxy-grid. Maybe someone can
> help me?!
>
>
> source (getCapabilities):
> =========================
>
> <
> https://rips-caches.lubw.baden-wuerttemberg.de/arcgis/rest/services/RIPS_TK_Cache/MapServer/WMTS
> ?>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Capabilities xmlns="http://www.opengis.net/wmts/1.0"
> xmlns:ows="http://www.opengis.net/ows/1.1"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:gml="http://www.opengis.net/gml"
> xsi:schemaLocation="http://www.opengis.net/wmts/1.0
> http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd"
> version="1.0.0">
> <!-- Service Identification --> <ows:ServiceIdentification>
> <ows:Title>RIPS_TK_Cache</ows:Title>
> <ows:ServiceType>OGC WMTS</ows:ServiceType>
> <ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
> </ows:ServiceIdentification> <!-- Operations Metadata -->
> <ows:OperationsMetadata>
> <ows:Operation name="GetCapabilities">
> <ows:DCP>
> <ows:HTTP>
> <ows:Get
> xlink:href="
> http://rips-caches.lubw.baden-wuerttemberg.de/arcgis/rest/services/RIPS_TK_Cache/MapServer/WMTS/1.0.0/WMTSCapabilities.xml
> ">
> <ows:Constraint name="GetEncoding">
> <ows:AllowedValues>
> <ows:Value>RESTful</ows:Value>
> </ows:AllowedValues>
> </ows:Constraint>
> </ows:Get>
> <!-- add KVP binding in 10.1 -->
> <ows:Get
> xlink:href="
> http://rips-caches.lubw.baden-wuerttemberg.de/arcgis/rest/services/RIPS_TK_Cache/MapServer/WMTS
> ?">
> <ows:Constraint name="GetEncoding">
> <ows:AllowedValues>
> <ows:Value>KVP</ows:Value>
> </ows:AllowedValues>
> </ows:Constraint>
> </ows:Get>
> </ows:HTTP>
> </ows:DCP>
> </ows:Operation>
> <ows:Operation name="GetTile">
> <ows:DCP>
> <ows:HTTP>
> <ows:Get
> xlink:href="
> http://rips-caches.lubw.baden-wuerttemberg.de/arcgis/rest/services/RIPS_TK_Cache/MapServer/WMTS/tile/1.0.0/
> ">
> <ows:Constraint name="GetEncoding">
> <ows:AllowedValues>
> <ows:Value>RESTful</ows:Value>
> </ows:AllowedValues>
> </ows:Constraint>
> </ows:Get>
> <ows:Get
> xlink:href="
> http://rips-caches.lubw.baden-wuerttemberg.de/arcgis/rest/services/RIPS_TK_Cache/MapServer/WMTS
> ?">
> <ows:Constraint name="GetEncoding">
> <ows:AllowedValues>
> <ows:Value>KVP</ows:Value>
> </ows:AllowedValues>
> </ows:Constraint>
> </ows:Get>
> </ows:HTTP>
> </ows:DCP>
> </ows:Operation>
> </ows:OperationsMetadata> <Contents>
> <!--Layer--> <Layer>
> <ows:Title>RIPS_TK_Cache</ows:Title>
> <ows:Identifier>RIPS_TK_Cache</ows:Identifier>
> <ows:BoundingBox crs="urn:ogc:def:crs:EPSG::25832">
> <ows:LowerCorner>250000.00000000093 5200000.000000004</ows:LowerCorner>
> <ows:UpperCorner>749999.9999999991 5600000.000000004</ows:UpperCorner>
> </ows:BoundingBox> <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
> <ows:LowerCorner>5.474640224093635 46.90644116046651</ows:LowerCorner>
> <ows:UpperCorner>12.525359775906365 50.55193238381328</ows:UpperCorner>
> </ows:WGS84BoundingBox>
> <Style isDefault="true">
> <ows:Title>Default Style</ows:Title>
> <ows:Identifier>default</ows:Identifier>
> </Style>
> <Format>image/png</Format>
> <TileMatrixSetLink>
> <TileMatrixSet>default028mm</TileMatrixSet>
> </TileMatrixSetLink>
> <ResourceURL format="image/png" resourceType="tile"
> template="
> http://rips-caches.lubw.baden-wuerttemberg.de/arcgis/rest/services/RIPS_TK_Cache/MapServer/WMTS/tile/1.0.0/RIPS_TK_Cache/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"
>
> />
> </Layer> <!--TileMatrixSet-->
> <TileMatrixSet>
> <ows:Title>TileMatrix using 0.28mm</ows:Title>
> <ows:Abstract>The tile matrix set that has scale values calculated based
> on the dpi defined by OGC specification (dpi assumes 0.28mm as the
> physical distance of a pixel).</ows:Abstract>
> <ows:Identifier>default028mm</ows:Identifier>
> <ows:SupportedCRS>urn:ogc:def:crs:EPSG::25832</ows:SupportedCRS>
> <TileMatrix>
> <ows:Identifier>0</ows:Identifier>
> <ScaleDenominator>472471.18303754483</ScaleDenominator>
> <TopLeftCorner>-5120900.0 9998100.0</TopLeftCorner>
> <TileWidth>256</TileWidth> <TileHeight>256</TileHeight>
> <MatrixWidth>174</MatrixWidth> <MatrixHeight>142</MatrixHeight>
> </TileMatrix>
> <TileMatrix>
> <ows:Identifier>1</ows:Identifier>
> <ScaleDenominator>188988.4732150179</ScaleDenominator>
> <TopLeftCorner>-5120900.0 9998100.0</TopLeftCorner>
> <TileWidth>256</TileWidth> <TileHeight>256</TileHeight>
> <MatrixWidth>434</MatrixWidth> <MatrixHeight>355</MatrixHeight>
> </TileMatrix>
> <TileMatrix>
> <ows:Identifier>2</ows:Identifier>
> <ScaleDenominator>94494.23660750895</ScaleDenominator>
> <TopLeftCorner>-5120900.0 9998100.0</TopLeftCorner>
> <TileWidth>256</TileWidth> <TileHeight>256</TileHeight>
> <MatrixWidth>867</MatrixWidth> <MatrixHeight>709</MatrixHeight>
> </TileMatrix>
> <TileMatrix>
> <ows:Identifier>3</ows:Identifier>
> <ScaleDenominator>47247.118303754476</ScaleDenominator>
> <TopLeftCorner>-5120900.0 9998100.0</TopLeftCorner>
> <TileWidth>256</TileWidth> <TileHeight>256</TileHeight>
> <MatrixWidth>1734</MatrixWidth> <MatrixHeight>1417</MatrixHeight>
> </TileMatrix>
> <TileMatrix>
> <ows:Identifier>4</ows:Identifier>
> <ScaleDenominator>23623.559151877238</ScaleDenominator>
> <TopLeftCorner>-5120900.0 9998100.0</TopLeftCorner>
> <TileWidth>256</TileWidth> <TileHeight>256</TileHeight>
> <MatrixWidth>3468</MatrixWidth> <MatrixHeight>2834</MatrixHeight>
> </TileMatrix>
> <TileMatrix>
> <ows:Identifier>5</ows:Identifier>
> <ScaleDenominator>11811.779575938619</ScaleDenominator>
> <TopLeftCorner>-5120900.0 9998100.0</TopLeftCorner>
> <TileWidth>256</TileWidth> <TileHeight>256</TileHeight>
> <MatrixWidth>6935</MatrixWidth> <MatrixHeight>5668</MatrixHeight>
> </TileMatrix>
> <TileMatrix>
> <ows:Identifier>6</ows:Identifier>
> <ScaleDenominator>6142.125379488082</ScaleDenominator>
> <TopLeftCorner>-5120900.0 9998100.0</TopLeftCorner>
> <TileWidth>256</TileWidth> <TileHeight>256</TileHeight>
> <MatrixWidth>13335</MatrixWidth> <MatrixHeight>10899</MatrixHeight>
> </TileMatrix>
> </TileMatrixSet>
> </Contents>
> <ServiceMetadataURL
> xlink:href="
> http://rips-caches.lubw.baden-wuerttemberg.de/arcgis/rest/services/RIPS_TK_Cache/MapServer/WMTS/1.0.0/WMTSCapabilities.xml"
>
> /> </Capabilities>
>
> parts of mapproxy-configuration:
> ================================
>
> layers:
>      - name: topo
>        title: topographische karte
>        sources: [cache_topo]
>
>
> caches:
>      cache_topo:
>          grids: [rips_grid]
>          sources: [source_topo]
>          format: image/png
>          request_format: image/png
>
> source_topo:
>      type: tile
>      grid: rips_grid
>      url:
>
> https://rips-caches.lubw.baden-wuerttemberg.de/arcgis/rest/services/RIPS_TK_Cache/MapServer/WMTS/tile/1.0.0/RIPS_TK_Cache/default/default028mm/%(z)s/%(x)s/%(y)s.png
>      coverage:
>        bbox: [5.474640224093635, 46.90644116046651, 12.525359775906365,
> 50.55193238381328]
>        bbox_srs: 'EPSG:4326'
>
>
>
> rips_grid:
>      origin: 'nw'
>      bbox: [5.474640224093635, 46.90644116046651, 12.525359775906365,
> 50.55193238381328]
>      bbox_srs: 'EPSG:4326'
>      srs: 'EPSG:25832'
>
>      # mapproxy-util scales --as-res-config 472471.18303754
> 188988.47321502 94494.23660751 47247.11830375 23623.55915188
> 11811.77957594 6142.12537949
>      res: [
>          #  res            level     scale @90.7 DPI
>          132.2919312505, #  0      472471.18303754
>           52.9167725002, #  1      188988.47321502
>           26.4583862501, #  2       94494.23660751
>           13.2291931250, #  3       47247.11830375
>            6.6145965625, #  4       23623.55915188
>            3.3072982813, #  5       11811.77957594
>            1.7197951063, #  6        6142.12537949
>          ]
>
>
> Problems:
> =========
>
> 1. check wmts via qgis (see url above): map is visible. At zoom 0 the
> urls of tiles with maps have a range between
> TileCol [160..171]
> TileRow [131..140]
> see for example (Pforzheim):
> <
> http://rips-caches.lubw.baden-wuerttemberg.de/arcgis/rest/services/RIPS_TK_Cache/MapServer/WMTS/tile/1.0.0/RIPS_TK_Cache/default/default028mm/0/135/165.png>
>
>
>
> 2. if I check the wmts in mapproxy-demo, no map is visible. Following
> errors are seen:
>
> [2019-06-03 17:35:53,563] mapproxy.source.request - INFO - GET
>
> https://rips-caches.lubw.baden-wuerttemberg.de/arcgis/rest/services/RIPS_TK_Cache/MapServer/WMTS/tile/1.0.0/RIPS_TK_Cache/default/default028mm/0/10/4.png
> 404 - 151
> [2019-06-03 17:35:53,563] mapproxy.source.tile - WARNING - could not
> retrieve tile: HTTP Error
> "
> https://rips-caches.lubw.baden-wuerttemberg.de/arcgis/rest/services/RIPS_TK_Cache/MapServer/WMTS/tile/1.0.0/RIPS_TK_Cache/default/default028mm/0/10/4.png":
>
> 404
>
> At zoom 0 the urls of tiles with maps have a range between
> TileCol [4..7]
> TileRow [6..10]
>
> Do I have to set an offset? (Is this possible?) I tried to use the bbox
> in utm32-coordinates. No effect.
>
> Thanks in advance!
>
>
> _______________________________________________
> MapProxy mailing list
> MapProxy at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapproxy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapproxy/attachments/20190604/16d48ab4/attachment-0001.html>


More information about the MapProxy mailing list