qgis / qwc2-demo-app

QWC2 demo application
Other
240 stars 149 forks source link

small imporovements height profile print #528

Closed danceb closed 4 months ago

danceb commented 4 months ago

I would suggest to place the print button directly underneath the header as it realized in legend print. Now it is placed at the bottom. The generated html page is not scrollable (just in my case?) and in this case the button is missed by the user, when it is outside of the visible page extent.

And furthermore external layers are not printed in the map if they don't provide a specific style as the STYLE is named undefined and not default. I got this error here:

 <ServiceException code="StyleNotDefined">unsupported styles: undefined</ServiceException>
manisandro commented 4 months ago

Thanks, the improvements to the legend print page are implemented in https://github.com/qgis/qwc2/commit/10b88bdbeedbbb3def714971659503ec347a4fa4.

Can you send me the full GetMap URL for which you get the error?

danceb commented 4 months ago

Thanks!

Shure, thats the with line breaks formatted GetMap-Request, which is external available:

https://map.jena.de/ows/kartenportal_kommunales?SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetMap
&TRANSPARENT=true
&TILED=false
&CRS=EPSG%3A25832
&BBOX=665124.2607677798%2C5637188.2520404635%2C696874.2607677798%2C5650814.29370713
&WIDTH=1920
&HEIGHT=824
&HIGHLIGHT_GEOM=LINESTRING+%28675046.14+5648052.71%2C+687696.53+5643306.74%29
&HIGHLIGHT_SYMBOL=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%3CStyledLayerDescriptor+xmlns%3D%22http%3A%2F%2Fwww.opengis.net%2Fsld%22+xmlns%3Aogc%3D%22http%3A%2F%2Fwww.opengis.net%2Fogc%22+xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22+version%3D%221.1.0%22+xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22+xsi%3AschemaLocation%3D%22http%3A%2F%2Fwww.opengis.net%2Fsld+http%3A%2F%2Fschemas.opengis.net%2Fsld%2F1.1.0%2FStyledLayerDescriptor.xsd%22+xmlns%3Ase%3D%22http%3A%2F%2Fwww.opengis.net%2Fse%22%3E%3CUserStyle%3E%3Cse%3AFeatureTypeStyle%3E%3Cse%3ARule%3E%3Cse%3ALineSymbolizer%3E%3Cse%3AStroke%3E%3Cse%3ASvgParameter+name%3D%22stroke%22%3E%23ff0000%3C%2Fse%3ASvgParameter%3E%3Cse%3ASvgParameter+name%3D%22stroke-opacity%22%3E1%3C%2Fse%3ASvgParameter%3E%3Cse%3ASvgParameter+name%3D%22stroke-width%22%3E4%3C%2Fse%3ASvgParameter%3E%3Cse%3ASvgParameter+name%3D%22stroke-linejoin%22%3Eround%3C%2Fse%3ASvgParameter%3E%3C%2Fse%3AStroke%3E%3C%2Fse%3ALineSymbolizer%3E%3C%2Fse%3ARule%3E%3C%2Fse%3AFeatureTypeStyle%3E%3C%2FUserStyle%3E%3C%2FStyledLayerDescriptor%3E
&CSRF_TOKEN=
&LAYERS=EXTERNAL_WMS%3AA%2CFlurst%C3%BCcke%2CFlur%2CGemarkung
&OPACITIES=255%2C255%2C255%2C255
&STYLES=%2C%2C%2C
&COLORS=%2C%2C%2C
&FILTER=
&A%3AURL=https%3A%2F%2Fmap.jena.de%2Fmapproxy%2Fwms
&A%3ALAYERS=Stadtplan
&A%3ASTYLES=undefined
&A%3AFORMAT=image%2Fpng
&A%3ACRS=EPSG%3A25832
&A%3ADPIMODE=7
&A%3ACONTEXTUALWMSLEGEND=0
&A%3AOPACITIES=255

If STYLES=undefined is set as STYLES=default for the external wms the background is printed:

https://map.jena.de/ows/kartenportal_kommunales?SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetMap
&TRANSPARENT=true
&TILED=false
&CRS=EPSG%3A25832
&BBOX=665124.2607677798%2C5637188.2520404635%2C696874.2607677798%2C5650814.29370713
&WIDTH=1920
&HEIGHT=824
&HIGHLIGHT_GEOM=LINESTRING+%28675046.14+5648052.71%2C+687696.53+5643306.74%29
&HIGHLIGHT_SYMBOL=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%3CStyledLayerDescriptor+xmlns%3D%22http%3A%2F%2Fwww.opengis.net%2Fsld%22+xmlns%3Aogc%3D%22http%3A%2F%2Fwww.opengis.net%2Fogc%22+xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22+version%3D%221.1.0%22+xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22+xsi%3AschemaLocation%3D%22http%3A%2F%2Fwww.opengis.net%2Fsld+http%3A%2F%2Fschemas.opengis.net%2Fsld%2F1.1.0%2FStyledLayerDescriptor.xsd%22+xmlns%3Ase%3D%22http%3A%2F%2Fwww.opengis.net%2Fse%22%3E%3CUserStyle%3E%3Cse%3AFeatureTypeStyle%3E%3Cse%3ARule%3E%3Cse%3ALineSymbolizer%3E%3Cse%3AStroke%3E%3Cse%3ASvgParameter+name%3D%22stroke%22%3E%23ff0000%3C%2Fse%3ASvgParameter%3E%3Cse%3ASvgParameter+name%3D%22stroke-opacity%22%3E1%3C%2Fse%3ASvgParameter%3E%3Cse%3ASvgParameter+name%3D%22stroke-width%22%3E4%3C%2Fse%3ASvgParameter%3E%3Cse%3ASvgParameter+name%3D%22stroke-linejoin%22%3Eround%3C%2Fse%3ASvgParameter%3E%3C%2Fse%3AStroke%3E%3C%2Fse%3ALineSymbolizer%3E%3C%2Fse%3ARule%3E%3C%2Fse%3AFeatureTypeStyle%3E%3C%2FUserStyle%3E%3C%2FStyledLayerDescriptor%3E
&CSRF_TOKEN=
&LAYERS=EXTERNAL_WMS%3AA%2CFlurst%C3%BCcke%2CFlur%2CGemarkung
&OPACITIES=255%2C255%2C255%2C255
&STYLES=%2C%2C%2C
&COLORS=%2C%2C%2C
&FILTER=
&A%3AURL=https%3A%2F%2Fmap.jena.de%2Fmapproxy%2Fwms
&A%3ALAYERS=Stadtplan
&A%3ASTYLES=default
&A%3AFORMAT=image%2Fpng
&A%3ACRS=EPSG%3A25832
&A%3ADPIMODE=7
&A%3ACONTEXTUALWMSLEGEND=0
&A%3AOPACITIES=255

Or is this related to Mapproxy?

manisandro commented 4 months ago

I cannot reproduce this with the latest qwc2 master. What version are you using? Is this a freshly set up map or a restored permalink?

danceb commented 4 months ago

I've tested it with another external wms service which is not part of our mapproxy and it works as expected there. So it seems to be related with the mapproxy and how the style naming/requesting is handled there.

danceb commented 4 months ago

mh, it seems I have no option in mapproxy to control this, as a mapproxy layer does not have different styles. So where does the style name in the GetMap-Request comes from if no style name is provided by the requested wms?

manisandro commented 4 months ago

For external layers, this is here [1], which is then used here [2] and finally here [3] when building the print params. The undefined leaves me a bit perplexed, since throughout the fallback for undefined values is an empty string. Can you check where the undefined comes from by inspecting the values of style around [1], [2] and [3]?

[1] https://github.com/qgis/qwc2/blob/10b88bdbeedbbb3def714971659503ec347a4fa4/utils/ServiceLayerUtils.js#L209 [2] https://github.com/qgis/qwc2/blob/10b88bdbeedbbb3def714971659503ec347a4fa4/utils/LayerUtils.js#L172 [3] https://github.com/qgis/qwc2/blob/10b88bdbeedbbb3def714971659503ec347a4fa4/utils/LayerUtils.js#L795

manisandro commented 4 months ago

We've just had a similar situation, and the cause was that in the manually defined background layer WMS params, there were N entries in LAYERS, and a STYLE param with just one entry. Perhaps this is the same problem here? STYLE needs to have the same number of (comma separated) entries as LAYERS.

danceb commented 4 months ago

Results of some more testing:

The issue only occurs, if a wms as set as "printLayer" in the background layer config and this one is used for printing. I have tested it with different wms services (our owns and also externals) and its always STYLES=undefined.

It works, if the background layer itself is a wms and used for printing as well without an additional print layer config.

manisandro commented 4 months ago

You mean "printLayer": "wms:<url>#<layername>"?

danceb commented 4 months ago

Yes, exactly. As there is only the possibility to set the layer name for printing and not a style name in the ressource string, maybe the issue somewhere here.

manisandro commented 4 months ago

Ok thanks, I'll investigate

manisandro commented 4 months ago

Ok found it, should be fixed in https://github.com/qgis/qwc2/commit/c4be3e974381384f67b2fe09e8dbe80c6acf4ef4