[MapProxy] Layer merging problem

Just van den Broecke just at justobjects.nl
Wed Mar 22 14:54:37 PDT 2017


Marco,

I do quite some layer-merging, but at the "caches"-level with png-def 
globals, even if the final tiling format is jpeg, combining/cascading 
sources, either other caches or WMS. For example, config excerpt, Dutch 
open PDOK arial tiles overlayed with roads&labels as in
https://app.map5.nl/nltopo/#rd/openlufo/10/139575.9/448029.5 :


layers:
   - name: openlufo
     title: OpenLufo
     sources: [openlufo_file_cache]

caches:
   openlufo_file_cache:
     grids: [geonovum_grid, opentopo_extent_grid]
     sources: [lufo_pdok_wms, luforoadslabels_file_cache]
     disable_storage: false
     format: image/jpeg

   luforoadslabels_file_cache:
     grids: [geonovum_grid, opentopo_extent_grid]
     disable_storage: false
     sources: [luforoads_file_cache,lufolabels_file_cache]
     format: png8
.
.
   lufolabels_file_cache:
     grids: [geonovum_grid, opentopo_extent_grid]
     sources: [lufolabels_wms]
     format: png8

   luforoads_file_cache:
     grids: [geonovum_grid, opentopo_extent_grid]
     sources: [luforoads_wms]
     format: png8opaque

globals:

   image:
     resampling_method: bilinear
     paletted: true
     formats:
       png8:
         format: image/png
         colors: 256

       png8opaque:
         format: image/png
         colors: 256
         opacity: 0.25

But I don't see any merging within MP in your config...my use-case may 
be different.

Best,

Just van den Broecke
http://justobjects.nl

On 22-03-17 09:26, deduikertjes wrote:
> Travis,
>
> Thanks for the pointer. Really usefull.
>
> It leads me to some very usefull insights, but I'm not sure that all
> behavior is as expected.
>
> Adding to the source:
>     image:
>       opacity: 1
> AND setting the image format on the cache to image/png:
>      format: image/png
>
> does something very usefull: it merges all layers as wished as long as
> there is no fully opaque (as served from the source wms) layer in the
> mix. If so, the fully opaque layer will off course prevent all layers
> below to be shown. That I'd like to solve by giving some opacity to that
> layer. Preferably via a generic option on the cache like:
>
> Adding an opacity setting to the cache on top of the settings above like:
>     image: {opacity: 0.8}
>
> But ... this does something odd. The opacity setting is applied with
> each layer added, so the bottom most layer in the resulting image is
> barely visible. I think that is not as it should be. Opacity should only
> be applied to the layer added to the stack of layers, not the stack it self.
>
> If I use a setting on a fully opaque (as served from the source wms)
> layer source like:
>     image:
>       opacity: 0.8
> The layers below this one are not visible at all. I do not think that is
> as it should be.
>
> Do I have found two issues or am I missing some advanced config trick
> again? Again any help appreciated.
>
> MArco
>
> On 21-03-17 22:14, Travis Kirstine wrote:
>>
>> does this help:
>>
>>
>> https://github.com/mapproxy/mapproxy/blob/master/mapproxy/test/system/fixture/combined_sources.yaml
>>
>> On 21 March 2017 at 11:15, deduikertjes <deduikertjes at xs4all.nl
>> <mailto:deduikertjes at xs4all.nl>> wrote:
>>
>>     Travis,
>>
>>     Thanks. I tried. Mapproxy reports:
>>
>>     mapproxy.config - WARNING - unknown 'opacity' in globals.image.formats.my_format
>>
>>     Seems logical as opacity is not mentioned in the docs as an option
>>     for an image format
>>     On 21-03-17 14:50, Travis Kirstine wrote:
>>>     I added a new global my_format with the opacity defined and used
>>>     it for the caches - does that work?
>>>     On 21 March 2017 at 07:03, deduikertjes <deduikertjes at xs4all.nl
>>>     <mailto:deduikertjes at xs4all.nl>> wrote:
>>>
>>>         Layer merging problem Hi List, When (vertically) merging
>>>         layers (mapproxy 1.9) results are not as expected. Merging
>>>         two layers which have fully transparent areas show only the
>>>         topmost layer. The bottom layer is not shown as should (not
>>>         at all). If the top layer has no fully transparent areas but
>>>         is completely opaque and opacity is set to eg 0.8 the bottom
>>>         layer is shown as should. Did I make a config error or did I
>>>         run into a bug? Any help greatly appreciated, MArco An
>>>         excerpt from my config: services:   tms:     # needs no
>>>         arguments   wms:     srs: ['EPSG:28992']     image_formats:
>>>         ['image/png', 'png'] globals:   cache:
>>>         minimize_meta_requests: true     meta_size: [1, 1]
>>>         meta_buffer: 0       image:     paletted: false     formats:
>>>               image/png:         mode: RGBA         transparent: true
>>>         *     my_format:     *
>>>         *        format: image/png:         mode: RGBA
>>>         transparent: true*
>>>
>>>     *          opacity: 0.8*
>>>
>>>
>>>         sources:   wms_source1:     type: wms     wms_opts:
>>>         featureinfo: true       legendgraphic: true
>>>         supported_srs: ['EPSG:28992']     req:       url:
>>>         'http://myservice.nl/geoserver/gwc/service/wms
>>>         <http://myservice.nl/geoserver/gwc/service/wms>?'
>>>         layers: 'layer1'       transparent: true   wms_source2:
>>>         type: wms     wms_opts:       featureinfo: true
>>>         legendgraphic: true     supported_srs: ['EPSG:28992']
>>>         req:       url:
>>>         'http://myservice.nl/geoserver/gwc/service/wms
>>>         <http://myservice.nl/geoserver/gwc/service/wms>?'
>>>         layers: 'layer2'       transparent: true caches:   _source1:
>>>              sources: [wms_source1]      link_single_color_images:
>>>         true      disable_storage: true
>>>         *     format: my_format*
>>>           _source2:      sources: [wms_source2]
>>>         link_single_color_images: true      disable_storage: true
>>>         *     format: my_format*
>>>         layers:   - name: 'layer1'     sources: [_source1]     title:
>>>         'layer 1'   - name: 'layer2'     sources: [_source2]
>>>         title: 'Layer 2'
>>>         _______________________________________________ MapProxy
>>>         mailing list MapProxy at lists.osgeo.org
>>>         <mailto:MapProxy at lists.osgeo.org>
>>>         https://lists.osgeo.org/mailman/listinfo/mapproxy
>>>         <https://lists.osgeo.org/mailman/listinfo/mapproxy>
>>>
>
>
> _______________________________________________
> MapProxy mailing list
> MapProxy at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapproxy
>





More information about the MapProxy mailing list