qgis / qwc2-demo-app

QWC2 demo application
Other
240 stars 149 forks source link

MapExport always sending a .pdf file on chromium based browsers #489

Closed cazitouni closed 8 months ago

cazitouni commented 8 months ago

When Using the MapExport plugin (or RasterExport), it always return a .pdf file on chromium based browsers.

Changing the file extension after the download (.pdf to .png for example) show that the file works fines but get downloaded with the wrong extension.

On firefox the file get downloaded with the correct extension.

The problem seems to be here.

What could be a good solution, map the content type to an extension using a var ?

manisandro commented 8 months ago

Thanks, should be fixed by https://github.com/qgis/qwc2/commit/c8a7b3f9e60279b6eba24fc2217d86827d9d0b31

cazitouni commented 8 months ago

@manisandro Should work great thanks. Also MapExport seems to have another issue when using external wms for background printlayer with syntax like : "wms:https://viewer.wisiglw.cus.fr/qgis/refer_fond_gris#refer_fond_gris"

It works great with the print plugin but return an error with the MapExport.

Maybe it's related with Qgis server, because it passes a getMap instead of a getPrint ?

manisandro commented 8 months ago

Can you post your configuration?

cazitouni commented 8 months ago

This is the theme I've tested to in the tenantconfig. image everything works fine except the Mapexport when the background layer is enabled. If i disable the background layer or remove the "wms:https://viewer.wisiglw.cus.fr/qgis/refer_fond_gris#refer_fond_gris" part from the request it works fine.

For the MapExport it's configured with no particular options :

image

I've tried to switch externallayers but doesnt work either.

The request made by MapExport looks like this : https://viewer.wisiglw.cus.fr/qgis/GUPDT_test?FORMAT=image%2Fpng&DPI=96&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=wms%3Ahttps%3A%2F%2Fviewer.wisiglw.cus.fr%2Fqgis%2Frefer_fond_gris%23refer_fond_gris%2Catlas%2Cquartiers%2Cgestion_proximite%2Cverif_adresse&OPACITIES=255%2C255%2C255%2C255%2C255&COLORS=%2C%2C%2C%2C&TRANSPARENT=true&TILED=false&STYLES=&CRS=EPSG%3A3948&filename=GUPDT_test.png&BBOX=2049580.6990940273%2C7274591.562787914%2C2052946.1990940273%2C7276814.062787914&WIDTH=318&HEIGHT=210&HIGHLIGHT_GEOM=&HIGHLIGHT_SYMBOL=&HIGHLIGHT_LABELSTRING=&HIGHLIGHT_LABELCOLOR=&HIGHLIGHT_LABELBUFFERCOLOR=&HIGHLIGHT_LABELBUFFERSIZE=&HIGHLIGHT_LABELSIZE=&csrf_token=573ce314-20e6-4bd4-b161-9a17301e516c

manisandro commented 8 months ago

It is actually more a coincidence than design that this works when printing, resp. it is because the qwc-print-service will resolve the wms:https://viewer.wisiglw.cus.fr/qgis/refer_fond_gris#refer_fond_gris resource string which appears in LAYERS in the request URL. By current design printLayer should really be a name of a QGIS project layer.

I take you have a client-side WMTS, and want to use a WMS when printing, without having to explicitly add the layer to the project?

cazitouni commented 8 months ago

@manisandro Yes that's it, I use a mapproxy cached background for the viewer but want to pass a batter quality wms when printing/exporting.

Should I do something different to achieve that ?

manisandro commented 8 months ago

This is actually a neat feature, I've implemented it in https://github.com/qgis/qwc2/commit/5818e2f23897f840ab82a02df3ded03c27f25a4c