[MapProxy] WMTS layers using different styles from WMS backend

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[MapProxy] WMTS layers using different styles from WMS backend

Trond Michelsen-4
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
_______________________________________________
MapProxy mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapproxy
Reply | Threaded
Open this post in threaded view
|

Re: [MapProxy] WMTS layers using different styles from WMS backend

Travis Kirstine
Trond

From my experience to provide a layer in a tile based service you must have a cache defined, so you are correct.

If you are interested tagged source names in the layers to do this to some extent for WMS service


  "layers" : [
     {
        "name"  : "testlayer"
        "title" : "testlayer",
        "sources" : [wms_myserver:testlayer
        ],
     },
     {
        "name"  : "testlayer2"
        "title" : "testlayer2",
        "sources" : [wms_myserver:testlayer2
        ],
     }  
  ]

However since there is no cache defined for the layers these layers would only be available in a WMS service, request to this service would simply be proxied to the backend source wms.

You could then use the tile_source to define layers which would be available  in the tile services

  "layers" : [
     {
        "name"  : "testlayer"
        "title" : "testlayer",
        "sources" : [wms_myserver:testlayer],
        "tile_sources": [cache_testlayer],  # assuming you've defined a cache 'cache_testlayer' for only tile services   
     },
     {
        "name"  : "testlayer2"
        "title" : "testlayer2",
        "sources" : [wms_myserver:testlayer2],
     },
      {
        "name"  : "alllayers"
        "title" : "alllayers",
        "sources" : [alllayers_cache],  # assuming you've defined a cache 'alllayers' for both wms and tile 
     }, 
  ]


Regards



On Mon, 10 Sep 2018 at 10:41, Trond Michelsen <[hidden email]> wrote:
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
_______________________________________________
MapProxy mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapproxy

_______________________________________________
MapProxy mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapproxy
Reply | Threaded
Open this post in threaded view
|

Re: [MapProxy] WMTS layers using different styles from WMS backend

Trond Michelsen-4
Thank you for the suggestion. But, I think I may have oversimplified
the case when I asked the question.

In my setup, I generate one new configfile daily, and this is
currently over 100.000 lines long.

This is what I'd like to simplify

You can see the file here:

  http://crusaders.no/~trondmm/mapproxy_demofiles/Norway_2018-05-16.yaml

In this config, there are over 3700 wms source definitions, but there
are only two base configurations. The only thing that differs between
the rest, are the URL and the coverage.

So, if it's possible to simplify the wms source configuration, and
dramatically reduce the total size of the config file, I'd really
appreciate some pointers.

--
Trond Michelsen


On Wed, Sep 12, 2018 at 09:26:40AM -0400, Travis Kirstine wrote:

> Trond
>
> From my experience to provide a layer in a tile based service you must have
> a cache defined, so you are correct.
>
> If you are interested tagged source names in the layers to do this to some
> extent for WMS service
>
> https://mapproxy.org/docs/nightly/sources.html#tagged-source-names
>
>   "layers" : [
>      {
>         "name"  : "testlayer"
>         "title" : "testlayer",
>         "sources" : [wms_myserver:testlayer
>         ],
>      },
>      {
>         "name"  : "testlayer2"
>         "title" : "testlayer2",
>         "sources" : [wms_myserver:testlayer2
>         ],
>      }
>   ]
>
> However since there is no cache defined for the layers these layers would
> only be available in a WMS service, request to this service would simply be
> proxied to the backend source wms.
>
> You could then use the tile_source to define layers which would be
> available  in the tile services
>
>   "layers" : [
>      {
>         "name"  : "testlayer"
>         "title" : "testlayer",
>         "sources" : [wms_myserver:testlayer],
>         "tile_sources": [cache_testlayer],  # assuming you've defined a
> cache 'cache_testlayer' for only tile services
>      },
>      {
>         "name"  : "testlayer2"
>         "title" : "testlayer2",
>         "sources" : [wms_myserver:testlayer2],
>      },
>       {
>         "name"  : "alllayers"
>         "title" : "alllayers",
>         "sources" : [alllayers_cache],  # assuming you've defined a cache
> 'alllayers' for both wms and tile
>      },
>   ]
>
>
> Regards
>
>
>
> On Mon, 10 Sep 2018 at 10:41, Trond Michelsen <[hidden email]>
> wrote:
>
> > 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
> > _______________________________________________
> > MapProxy mailing list
> > [hidden email]
> > https://lists.osgeo.org/mailman/listinfo/mapproxy

--
Trond Michelsen
_______________________________________________
MapProxy mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapproxy