qgis/qwc2-demo-app

Print and map export does not work correct with multi style layers

Closed this issue · 3 comments

The new function for providing/selecting multiple layer styles does not work properly with printing and the map export plugin. There are different issues here:

  • Printing fails overall if a multi style layer is checked in the layer tree
  • Map Export is possible, but only, if just one multi style layer is checked. But in this case the default style is always exported and not another one, if selected
  • map export is also failing if more than one multi style layer are checked

Can you provide more details? (Stacktraces, request error responses, ...)? I can successfully print/export a project with multiple multi-style layers here.

The issue is, that it mixes the styles here, if an external wms layer (the background layer for instance) should be printed as well. While printing it tries to apply the style to another layer, from whom the style is not part of. From the log:

qwc-ogc-service_1              |   LAYERS = EXTERNAL_WMS:A,Flurstücke
[...]
qwc-ogc-service_1              |   STYLES = Umrandung und Beschriftung rot,
[...]
qwc-ogc-service_1              |   A:URL = https://ows.jena.de/mapproxy/wms
qwc-ogc-service_1              |   A:LAYERS = Stadtplan_300
qwc-ogc-service_1              |   A:STYLES = 
[...]
qwc-ogc-service_1              |   MAP0:LAYERS = EXTERNAL_WMS:A,Flurstücke
qwc-ogc-service_1              |   MAP0:STYLES = Umrandung und Beschriftung rot
[...]
qwc-qgis-server_1              | <ServiceExceptionReport version="1.3.0" xmlns="http://www.opengis.net/ogc">
qwc-qgis-server_1              |  <ServiceException code="StyleNotDefined">Style 'Umrandung und Beschriftung rot' does not exist for layer 'A'</ServiceException>
qwc-qgis-server_1              | </ServiceExceptionReport>

So the style Umrandung und Beschriftung rot is actually a style from the layer Flurstücke, but it tries to apply this on layer A, which is the external background layer for printing.

The same here with multiple layers with named styles:

qwc-ogc-service_1              |   LAYERS = EXTERNAL_WMS:A,Flurstücke,Flur
[...]
qwc-ogc-service_1              |   STYLES = Umrandung und Beschriftung rot,blaue Umrandung,
[...]
qwc-ogc-service_1              |   A:URL = https://ows.jena.de/mapproxy/wms
qwc-ogc-service_1              |   A:LAYERS = Stadtplan_300
qwc-ogc-service_1              |   A:STYLES = 
[...]
qwc-ogc-service_1              |   MAP0:LAYERS = EXTERNAL_WMS:A,Flurstücke,Flur
qwc-ogc-service_1              |   MAP0:STYLES = Umrandung und Beschriftung rot,blaue Umrandung
[...]
qwc-qgis-server_1              | <ServiceExceptionReport version="1.3.0" xmlns="http://www.opengis.net/ogc">
qwc-qgis-server_1              |  <ServiceException code="StyleNotDefined">Style 'blaue Umrandung' does not exist for layer 'Flurstücke'</ServiceException>
qwc-qgis-server_1              | </ServiceExceptionReport>

Here it tries to apply the style blaue Umrandung to layer Flurstücke but its actually a part of the layer Flur.

The mapping from styles and layers seems to work correctly if no external layer is included in the printing request.

I couldn't reproduce the third case anymore, that the map is printed but with the wrong style, but I think it is related to the issue mentioned here.

Thanks, this should be fixed by qgis/qwc2@917c253