qgis / qwc2-demo-app

QWC2 demo application
Other
243 stars 155 forks source link

Not all layers are shown using additional themes while pdf printing or raster export #267

Closed danceb closed 2 years ago

danceb commented 3 years ago

We are using a QWC2 instance based on the qwc-docker using the qwc-services. Within the config.json the parameter "AllowAddingOtherThemes" is set to "true", so there is the possibility to load an initial theme and add other themes to the map so the layers of the other themes appear within the layer tree. When you use this map view for PDF printing or the raster export tool only the layers of the initial theme are printed/exported. All layers which are added in addition do not appear on the output pdf/raster. Are there any known issues related to this problem? I couldn't find one. I will appretiate any help or ideas, thanks!

grafik (grey boxes because of sensitive data)

manisandro commented 3 years ago

You'll need to set printExternalLayers: true in the cfg block of the Print plugin, as layers from other themes are treated as external layers. Support for raster-exporting external layers OTOH is currently not implemented.

danceb commented 3 years ago

Ok, thanks for the quick response! I will close this issue now.

mbernasocchi commented 2 years ago

You'll need to set printExternalLayers: true in the cfg block of the Print plugin

hey @manisandro I've:

{
   "name": "Print",
   "cfg": {
      "inlinePrintOutput": false,
      "printExternalLayers": true
    }
},

in a deployment of mine and when adding a new theme to the main_theme and printing to PDF, the layers of the new theme are not printed.

the QGIS log also shows:

16:15:37 INFO Server[14]: DPI:300
16:15:37 INFO Server[14]: FORMAT:pdf
16:15:37 INFO Server[14]: LAYERS:orthofoto,layer_maintheme
16:15:37 INFO Server[14]: MAP:/io/data/demo.qgs

there is nowhere in the requests log a mention of layer_newtheme

do you have any pointers or did I miss something?

Grazie mille

manisandro commented 2 years ago

Hi @mbernasocchi , do you have

"qgisServerVersion": 3

in your config.json?

mbernasocchi commented 2 years ago

Hey @manisandro thanks for the super quick response.

no. is that top level in the JSON?

manisandro commented 2 years ago

yep, see https://github.com/qgis/qwc2-demo-app/blob/master/static/config.json#L28

mbernasocchi commented 2 years ago

did not help. still seeing only the "main" layers. server is 3.22.1

manisandro commented 2 years ago

Try stepping from here [1] into here [2] to see why those layers aren't added to the print request.

[1] https://github.com/qgis/qwc2/blob/74c5cb578ba64e4015fb4fbc542a2e5ac7207af9/plugins/Print.jsx#L120 [2] https://github.com/qgis/qwc2/blob/74c5cb578ba64e4015fb4fbc542a2e5ac7207af9/utils/LayerUtils.js#L653

mbernasocchi commented 2 years ago

@manisandro thanks for the help it was indeed a config.json issue. I had not noticed that config.json had changed location so I was editing an unused file :/ sorry for the noise