[MapProxy] WMTS layers using different styles from WMS backend

Trond Michelsen trondmm-mapproxy at crusaders.no
Mon Sep 10 06:31:58 PDT 2018


Hi.

I'm setting up a mapproxy wmts service, and several of the layers I'm
using should be available using different styles. 

Let's say I have a config like this:

  "layers" : [
     {
        "name"  : "testlayer"
        "title" : "testlayer",
        "sources" : [
           "cache_testlayer"
        ],
     }
  ],
  
  "sources" : {
    "wms_myserver" : {
      "coverage" : {
        "bbox" : [
          -110000,
          6420000,
          1130000,
          7980000
        ],
        "srs" : "EPSG:32633"
      },
      "concurrent_requests" : 16,
      "req" : {
        "transparent" : true,
        "url" : "http://myserver/wms?"
      },
      "type" : "wms"
    },
  },
  
  "caches" : {
    "cache_testlayer" : {
      "cache" : {
        "use_grid_names" : true,
        "directory_layout" : "tms",
        "type" : "file"
      },
      "cache_dir" : "/vol/cache/",
      "sources" : [
        "wms_myserver:testlayer",
      ],
      "grids" : [
        "utm33_norway"
      ]
    },
  },

Is it possible to add another layer, using the same WMS source, and
the same WMS layer, but using a different style, without adding a new
WMS source?

At the moment, I've been adding WMS sources for each new style that's required, e.g.:

  "sources" : {
    "wms_myserver_style_fancy" : {
      "coverage" : {
        "bbox" : [
          -110000,
          6420000,
          1130000,
          7980000
        ],
        "srs" : "EPSG:32633"
      },
      "concurrent_requests" : 16,
      "req" : {
        "styles" : "fancy",
        "transparent" : true,
        "url" : "http://myserver/wms?"
      },
      "type" : "wms"
    },

    "wms_myserver_style_dull" : {
      "coverage" : {
        "bbox" : [
          -110000,
          6420000,
          1130000,
          7980000
        ],
        "srs" : "EPSG:32633"
      },
      "concurrent_requests" : 16,
      "req" : {
        "styles" : "dull",
        "transparent" : true,
        "url" : "http://myserver/wms?"
      },
      "type" : "wms"
    },
  },
  
etc.

But this doesn't scale very well, and it does feel a little bit
illogical to do it like this. Is there a better way?

-- 
Trond Michelsen


More information about the MapProxy mailing list