3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
252 stars 141 forks source link

Enabling "Get images directly from WMS server" breaks printing #1223

Open shermp opened 5 years ago

shermp commented 5 years ago

What is the bug?

Enabling Get images directly from WMS server breaks printing.

I'm not sure if this is strictly a LWC issue, or a QGIS Server issue, or both. I'm leaning towards both.

Steps to reproduce the issue

  1. Add a WMS layer to QGIS project.
  2. Use Lizmap plugin to configure WMS layer and select Get images directly from WMS server
  3. Load map in LWC and attempt to print (Note, WMS layer displays successfully).
  4. Browser immediately shows the following error: This XML file does not appear to have any style information associated with it. The document tree is shown below.

Expected behavior

A PDF/png/etc should be generated and displayed/downloaded.

Screenshots and logs

QGIS server log:

01:43:32 INFO Server[27042]: ******************** New request ***************
01:43:32 INFO Server[27042]: SERVER_NAME127.0.0.1
01:43:32 INFO Server[27042]: REQUEST_URI/cgi-bin/qgis_mapserv.fcgi
01:43:32 INFO Server[27042]: REMOTE_ADDR127.0.0.1
01:43:32 INFO Server[27042]: CONTENT_TYPEapplication/x-www-form-urlencoded
01:43:32 INFO Server[27042]: HTTP_USER_AGENTLizmap
01:43:32 WARNING [27042]: Warning: error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post body.
01:43:32 WARNING [27042]: formatString is: pdf
01:43:32 INFO Server[27042]: DPI:100
01:43:32 INFO Server[27042]: EXCEPTIONS:application/vnd.ogc.se_inimage
01:43:32 INFO Server[27042]: FORMAT:pdf
01:43:32 INFO Server[27042]: LAYERS:WWWWWWWW,XXXXXXXXX,YYYYYYYYYY,ZZZZZZZZZ
01:43:32 INFO Server[27042]: MAP:/path/to/qgis/project/someproject.qgs
01:43:32 INFO Server[27042]: MAP0:EXTENT:5536049.588122,1647778.039691,5744554.602083,1791031.484536
01:43:32 INFO Server[27042]: MAP0:LAYERS:WWWWWWWW,XXXXXXXXX,YYYYYYYYYY,ZZZZZZZZZ
01:43:32 INFO Server[27042]: MAP0:SCALE:750000
01:43:32 INFO Server[27042]: MAP0:STYLES:default,,default,default
01:43:32 INFO Server[27042]: OPACITIES:255,255,255,255
01:43:32 INFO Server[27042]: REQUEST:GetPrint
01:43:32 INFO Server[27042]: SERVICE:WMS
01:43:32 INFO Server[27042]: SRS:EPSG:2193
01:43:32 INFO Server[27042]: STYLES:default,,default,default
01:43:32 INFO Server[27042]: TEMPLATE:XXXXX
01:43:32 INFO Server[27042]: TRANSPARENT:true
01:43:32 INFO Server[27042]: VERSION:1.3.0
01:43:32 INFO Server[27042]: WMS Request parameters:
01:43:32 INFO Server[27042]:  - SRS : EPSG:2193
01:43:32 INFO Server[27042]:  - LAYERS : WWWWWWWW,XXXXXXXXX,YYYYYYYYYY,ZZZZZZZZZ
01:43:32 INFO Server[27042]:  - OPACITIES : 255,255,255,255
01:43:32 INFO Server[27042]:  - FORMAT : pdf
01:43:32 INFO Server[27042]:  - TRANSPARENT : true
01:43:32 INFO Server[27042]:  - DPI : 100
01:43:32 INFO Server[27042]:  - TEMPLATE : XXXXX
01:43:32 INFO Server[27042]:  - VERSION : 1.3.0
01:43:32 INFO Server[27042]: Request finished in 7 ms

Note, layer XXXXXXXXX above is the WMS layer in question. Please let me know if the redacted log is not helpful.

Environment

Please let me know if you need more information.

rmarzocchi84 commented 5 years ago

I see the following error :

Warning: error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post bod

It give me error when I try to print without WMS layer in my project but only with new created print layout.

rmarzocchi84 commented 5 years ago

Qgis server log using two different print layout. The first give me error the second works.

ERROR:

6:06:54 INFO Server[2453]: ******************** New request ***************                                                                                                                                                               
16:06:54 INFO Server[2453]: SERVER_NAME127.0.0.1                                                                                                                                                                                           
16:06:54 INFO Server[2453]: REQUEST_URI/cgi-bin/qgis_mapserv.fcgi                                                                                                                                                                          
16:06:54 INFO Server[2453]: REMOTE_ADDR127.0.0.1                                                                                                                                                                                           
16:06:54 INFO Server[2453]: CONTENT_TYPEapplication/x-www-form-urlencoded                                                                                                                                                                  
16:06:54 INFO Server[2453]: HTTP_USER_AGENTLizmap                                                                                                                                                                                          
16:06:54 WARNING [2453]: Warning: error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post body.                                                       
16:06:54 WARNING [2453]: formatString is: pdf                                                                                                                                                                                              
16:06:54 INFO Server[2453]: DPI:100                                                                                                                                                                                                        
16:06:54 INFO Server[2453]: EXCEPTIONS:application/vnd.ogc.se_inimage                                                                                                                                                                      
16:06:54 INFO Server[2453]: FORMAT:pdf                                                                                                                                                                                                     
16:06:54 INFO Server[2453]: LAYERS:base cartografica,UU,v_amm_strade_sfalcio_fase1  copia,v_amm_strade_sfalcio_fase1,mun1,amm_circoscrizioni                                                                                               
16:06:54 INFO Server[2453]: MAP:/mnt/6112_sit/QGIS/PROGETTI/DISERBO/06-DISERBO_VIE_AMIU_UU_DB_SETTIMANE_MUNICIPI_FILL.qgs                                                                                                                  
16:06:54 INFO Server[2453]: MAP0:EXTENT:1494935.661841,4917908.230262,1495497.675356,4918298.23964                                                                                                                                         
16:06:54 INFO Server[2453]: MAP0:LAYERS:base cartografica,UU,v_amm_strade_sfalcio_fase1  copia,v_amm_strade_sfalcio_fase1,mun1,amm_circoscrizioni                                                                                          
16:06:54 INFO Server[2453]: MAP0:SCALE:2000                                                                                                                                                                                                
16:06:54 INFO Server[2453]: MAP0:STYLES:,predefinito,predefinito,predefinito,predefinito,predefinito                                                                                                                                       
16:06:54 INFO Server[2453]: OPACITIES:255,255,255,255,255,255                                                                                                                                                                              
16:06:54 INFO Server[2453]: REQUEST:GetPrint                                                                                                                                                                                               
16:06:54 INFO Server[2453]: SERVICE:WMS                                                                                                                                                                                                    
16:06:54 INFO Server[2453]: SRS:EPSG:3003                                                                                                                                                                                                  
16:06:54 INFO Server[2453]: STYLES:,predefinito,predefinito,predefinito,predefinito,predefinito                                                                                                                                            
16:06:54 INFO Server[2453]: TEMPLATE:A4_orizzontale                                                                                                                                                                                        
16:06:54 INFO Server[2453]: TRANSPARENT:true                                                                                                                                                                                               
16:06:54 INFO Server[2453]: VERSION:1.3.0                                                                                                                                                                                                  
16:06:54 INFO Server[2453]: WMS Request parameters:                                                                                                                                                                                        
16:06:54 INFO Server[2453]:  - SRS : EPSG:3003                                                                                                                                                                                             
16:06:54 INFO Server[2453]:  - LAYERS : base cartografica,UU,v_amm_strade_sfalcio_fase1  copia,v_amm_strade_sfalcio_fase1,mun1,amm_circoscrizioni                                                                                          
16:06:54 INFO Server[2453]:  - OPACITIES : 255,255,255,255,255,255                                                                                                                                                                         
16:06:54 INFO Server[2453]:  - FORMAT : pdf                                                                                                                                                                                                
16:06:54 INFO Server[2453]:  - TRANSPARENT : true                                                                                                                                                                                          
16:06:54 INFO Server[2453]:  - DPI : 100                                                                                                                                                                                                   
16:06:54 INFO Server[2453]:  - TEMPLATE : A4_orizzontale                                                                                                                                                                                   
16:06:54 INFO Server[2453]:  - VERSION : 1.3.0                                                                                                                                                                                             
16:06:54 INFO Server[2453]: Request finished in 19 ms

WORKS:

16:15:50 INFO Server[2453]: ******************** New request ***************                                                                                                                                                               
16:15:50 INFO Server[2453]: SERVER_NAME127.0.0.1                                                                                                                                                                                           
16:15:50 INFO Server[2453]: REQUEST_URI/cgi-bin/qgis_mapserv.fcgi                                                                                                                                                                          
16:15:50 INFO Server[2453]: REMOTE_ADDR127.0.0.1                                                                                                                                                                                           
16:15:50 INFO Server[2453]: CONTENT_TYPEapplication/x-www-form-urlencoded                                                                                                                                                                  
16:15:50 INFO Server[2453]: HTTP_USER_AGENTLizmap                                                                                                                                                                                          
16:15:50 WARNING [2453]: Warning: error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post body.                                                       
16:15:50 WARNING [2453]: formatString is: pdf                                                                                                                                                                                              
16:15:50 INFO Server[2453]: DPI:100                                                                                                                                                                                                        
16:15:50 INFO Server[2453]: EXCEPTIONS:application/vnd.ogc.se_inimage                                                                                                                                                                      
16:15:50 INFO Server[2453]: FORMAT:pdf                                                                                                                                                                                                     
16:15:50 INFO Server[2453]: LAYERS:base cartografica,UU,v_amm_strade_sfalcio_fase1  copia,v_amm_strade_sfalcio_fase1,amm_circoscrizioni                                                                                                    
16:15:50 INFO Server[2453]: MAP:/mnt/6112_sit/QGIS/PROGETTI/DISERBO/06-DISERBO_VIE_AMIU_UU_DB_SETTIMANE_MUNICIPI_FILL.qgs                                                                                                                  
16:15:50 INFO Server[2453]: MAP0:EXTENT:1491584.356884,4918069.143637,1492404.376603,4918551.155228                                                                                                                                        
16:15:50 INFO Server[2453]: MAP0:LAYERS:base cartografica,UU,v_amm_strade_sfalcio_fase1  copia,v_amm_strade_sfalcio_fase1,amm_circoscrizioni                                                                                               
16:15:50 INFO Server[2453]: MAP0:SCALE:1000                                                                                                                                                                                                
16:15:50 INFO Server[2453]: MAP0:STYLES:,predefinito,predefinito,predefinito,predefinito                                                                                                                                                   
16:15:50 INFO Server[2453]: OPACITIES:255,255,255,255,255                                                                                                                                                                                  
16:15:50 INFO Server[2453]: REQUEST:GetPrint                                                                                                                                                                                               
16:15:50 INFO Server[2453]: SERVICE:WMS                                                                                                                                                                                                    
16:15:50 INFO Server[2453]: SRS:EPSG:3003                                                                                                                                                                                                  
16:15:50 INFO Server[2453]: STYLES:,predefinito,predefinito,predefinito,predefinito                                                                                                                                                        
16:15:50 INFO Server[2453]: TEMPLATE:uu_settimane_es_report_26_maggio_19                                                                                                                                                                   
16:15:50 INFO Server[2453]: TRANSPARENT:true                                                                                                                                                                                               
16:15:50 INFO Server[2453]: VERSION:1.3.0                                                                                                                                                                                                  
16:15:50 INFO Server[2453]: WMS Request parameters:                                                                                                                                                                                        
16:15:50 INFO Server[2453]:  - SRS : EPSG:3003                                                                                                                                                                                             
16:15:50 INFO Server[2453]:  - LAYERS : base cartografica,UU,v_amm_strade_sfalcio_fase1  copia,v_amm_strade_sfalcio_fase1,amm_circoscrizioni                                                                                               
16:15:50 INFO Server[2453]:  - OPACITIES : 255,255,255,255,255                                                                                                                                                                             
16:15:50 INFO Server[2453]:  - FORMAT : pdf                                                                                                                                                                                                
16:15:50 INFO Server[2453]:  - TRANSPARENT : true                                                                                                                                                                                          
16:15:50 INFO Server[2453]:  - DPI : 100                                                                                                                                                                                                   
16:15:50 INFO Server[2453]:  - TEMPLATE : uu_settimane_es_report_26_maggio_19                                                                                                                                                              
16:15:50 INFO Server[2453]:  - VERSION : 1.3.0
rmarzocchi84 commented 5 years ago

Can be a problem due to the duplication of a layer?

using the layout that give me error I have 5 layers and 5 styles while using the layout that works I have 5 layer and only 4 styles.. (no style for the duplicate layer)

But I do not understand why and how can I change this behaviour in QGIS?

rmarzocchi84 commented 4 years ago

The problem is still present. I check the QGIS Server configuration (xvfb intsall) but it do not works.

Here the qgis error log (level 1)

19:27:03 WARNING Server[21016]: WMS capabilities document not found in cache
19:27:03 WARNING Server[21016]: Set WMS capabilities document in cache
19:27:03 WARNING Server[21016]: <ServiceExceptionReport version="1.3.0" xmlns="http://www.opengis.net/ogc">
 <ServiceException code="OperationNotSupported">Request GetCapabilitiesAtlas is not supported</ServiceException>
</ServiceExceptionReport>

19:27:04 WARNING Server[21016]: WMS capabilities document not found in cache
19:27:04 WARNING Server[21016]: Set WMS capabilities document in cache
19:27:04 WARNING [21016]: Service WFS 1.0.0 not found, returning default
19:27:16 WARNING [21016]: Warning: error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post body.
19:27:16 WARNING [21016]: formatString is: pdf
19:27:16 WARNING Server[21016]: <ServiceExceptionReport version="1.3.0" xmlns="http://www.opengis.net/ogc">
 <ServiceException code="LayerNotDefined">The layer '0' does not exist.</ServiceException>
</ServiceExceptionReport>

I have done some test with the followinf WMS. I read the problem can be related to WMTS? http://webapps.sit.puglia.it/arcgis/services/BaseMaps/Ortofoto2016/ImageServer/WMSServer

Gustry commented 1 year ago

There might a few things to check with the release of LWC 3.7 related to external WMS