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
254 stars 143 forks source link

Server error when trying to import the third-party WMS/WMTS as external baselayers. #1574

Open lmwu opened 4 years ago

lmwu commented 4 years ago

Lizmap is undoubtedly a project with better performance than the Geoserver. The experience is pretty awesome. Taiwan has its own official public WMS/WMTS called NGIS E-Map, and we used to use it as a common basemap in the staffing exchange. (WMTS - https://wmts.nlsc.gov.tw/wmts ; WMS - https://wms.nlsc.gov.tw/wms ; EPSG:3857) I tried many times to test the setting of configuration in QGIS project in which the NGIS WMS is layered, but all failed. Even though I followed the documentation which guide how to make external baselayers(in fact it's hard to ensure what the steps really are), still failed.

Would any expert here please to give me some advises or teach me the steps of configuration. Appreciate your help.

guenterw commented 4 years ago

I have a similar problem (if I understand Imwu correctly):

when testing with Lizmap 3.3.x and the QGIS server 3.12. I have a problem with the WMS services stored in the QGIS project.

The usual WMS services that work in Lizmap 3.1.x with QGIS-Server 2.18 [1] lead to complete blocking of the web project under Lizmap 3.3.x with the error message "SERVICE NON DISPONIBLEI":

grafik

Without the WMS services in the QGIS project, it works perfectly. Has anyone observed anything similar or an explanation?

Thanks and Greetings

[1] https://sg.geodatenzentrum.de/wms_topplus_web_open? https://owsproxy.lgl-bw.de/owsproxy/ows/WMS_Maps4BW?

lmwu commented 4 years ago

I have a similar problem (if I understand Imwu correctly):

when testing with Lizmap 3.3.x and the QGIS server 3.12. I have a problem with the WMS services stored in the QGIS project.

The usual WMS services that work in Lizmap 3.1.x with QGIS-Server 2.18 [1] lead to complete blocking of the web project under Lizmap 3.3.x with the error message "SERVICE NON DISPONIBLEI":

grafik

Without the WMS services in the QGIS project, it works perfectly. Has anyone observed anything similar or an explanation?

Thanks and Greetings

[1] https://sg.geodatenzentrum.de/wms_topplus_web_open? https://owsproxy.lgl-bw.de/owsproxy/ows/WMS_Maps4BW?

You totally understand what happens to me. Excuse me I wrote the comments without accurate explanation that the configuration failed in the lizmap session as yours.

lmwu commented 4 years ago

https://docs.qgis.org/testing/en/docs/user_manual/working_with_ogc/server/services.html#external-wms-layers

In the documentation as above, QGIS server can well publish the external wms service as a layer. As so, Lizmap should be capable to make it in the user web interface.

Any suggestion?

nboisteault commented 4 years ago

Hi @lmwu ! Thank you for your kind words.

Which layers did you try to display ? Do they contain chinese caracters ? Did you check "Get images directly from WMS Server"

lmwu commented 4 years ago

Hi @lmwu ! Thank you for your kind words.

Which layers did you try to display ? Do they contain chinese caracters ? Did you check "Get images directly from WMS Server"

Hi Thanks to your reply. I tried EMAP and PHOTO2 (identifier) and both of them didn't work when to publish in the lizmap. In the PHOTO2 layer there are not any chinese character, and "Get images directly from WMS server" is not available to check.

Would you please do me an huge favor to test what step I made wrong. Many thanks.

guenterw commented 4 years ago

Hello,

for me it's because of the special WMS services.

[1], which has a worldwide representation, does not work in Lizmap 3.3.5 with QGIS server 3.12.1. In QGIS, and also with Lizmap 3.1.x and with QGIS Server 2.18 everything works perfectly [3] (see group Hintergrundkarten)

[2] on the other hand works perfectly everywhere.

Is there an explanation for this?

And why does the WMS service block the entire presentation of the project? Is this a QGIS server or a Lizmap problem?

Thanks and Regards

[1] http://sgx.geodatenzentrum.de/wms_topplus_web_open? [2] http://ows.terrestris.de/osm/service [3] https://bauleitplanung.endingen.webgis.biz

lgiliberto commented 4 years ago

Hello, everybody,

I installed LWC a few days ago and I'm starting to set up a project. I'm having the same problem. Below are the installation specifications and the log message:

Lubuntu 18.04 (OsgeoLive) qgis-server 3.4.10 (OsgeoLive) LWC 3.3.5 wms service: https://owsproxy.lgl-bw.de/owsproxy/ows/WMS_Maps4BW?

log: 2020-03-29 14:31:00 192.168.0.2 warning 2020-03-29 14:31:00 [2] file_get_contents(http://127.0.0.1/cgi-bin/qgis_mapserv.fcgi?map=%2Fvar%2Fwww%2Fhtml%2Fliztest%2Fliztest%2Eqgs&request=GetCapabilities&service=WFS&version=1%2E0%2E0): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error /var/www/html/lwc-3.3.5/lizmap/modules/lizmap/classes/lizmapProxy.class.php 240

2020-03-29 14:31:00 192.168.0.2 error GetCapabilities empty data 2020-03-29 14:31:02 192.168.0.2 warning 2020-03-29 14:31:02 [2] touch(): Utime failed: Operation not permitted /var/www/html/lwc-3.3.5/lib/jelix-plugins/cache/file/file.cache.php 183

thank you all in advance for your time!!!

Luciano

lmwu commented 4 years ago

https://docs.lizmap.com/current/en/publish/lizmap_configuration.html

"If the layer is provided by a WMS service and that it supports the Web map Coordinate Reference System, it is possible to Directly Request images to the WMS server. This reduces the QGIS-Server load and optimize Lizmap. This option is available in the Third Party WMS layers group."

Anyone make it work with the description above? For me, the check-box " Directly Request images to the WMS server" is unavailable.

Need the developer's advice.

Kindly regards.

guenterw commented 4 years ago

I tried both variants. Both do not work with Lizmap 3.3.5 and QGIS-Server 3.12.1 (see above).

With Lizmap 3.1.x and QGIS-Server 2.18.28 I can confirm the speed advantage with the option "Request images directly to the WMS server". Everyone works fine there

lmwu commented 4 years ago

Any limitation in the higher version?

lgiliberto commented 4 years ago

Hi @lmwu

after some tests the problem seems to be the ssl certificate in apache/qgis-server.

http://ows.terrestris.de/osm/service (it works) https://ows.terrestris.de/osm/service (official link is not working) the same for Maps4BW and yours https://wms.nlsc.gov.tw/wms

quick and dirty solution = remove the s orthodox solution = install the certificate https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04

all the best,

Luciano

lmwu commented 4 years ago

Hi @lmwu

after some tests the problem seems to be the ssl certificate in apache/qgis-server.

http://ows.terrestris.de/osm/service (it works) https://ows.terrestris.de/osm/service (official link is not working) the same for Maps4BW and yours https://wms.nlsc.gov.tw/wms

quick and dirty solution = remove the s orthodox solution = install the certificate https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04

all the best,

Luciano

Means I have to install my own SSL for my WMS. Maybe I can use the free qgis cloud for it. Many thanks to you. Will try it soon later.

Best Regards,

guenterw commented 4 years ago

@Flaviano2punto0 this is interesting, but unfortunately I cannot confirm it. At first I suspected that it was due to the encryption (I think there was a problem like this before). But [1] and [2] don't work for me either, but strangely enough [3].

But I just had another insight: The error "SERVICE NON DISPONIBLEI" and thus the complete blockage of the web project also appears if another source, e.g. a SHAPE file cannot be loaded. Lizmap 3.1.x simply ignored such a circumstance with QGIs server 2.18 and did not display the layer.

To the WMS services: Is it possibly due to the response time from the service? The time to wait could be defined somewhere?

[1] http://owsproxy.lgl-bw.de/owsproxy/ows/WMS_Maps4BW? [2] http://sgx.geodatenzentrum.de/wms_topplus_web_open? [3] http://ows.terrestris.de/osm/service

lmwu commented 4 years ago

@Flaviano2punto0

For our NGIS, EPSG: 3857 is for WMTS and EPSG:3826 is for WMS.(I learn this new lesson.. ) When I was trying WMTS(without SSL), the check-box "Get images directly from WMS Server" in the lizmap configuration is unavailable.

nboisteault commented 4 years ago

@lmwu "Get images directly from WMS Server" works with WMS not WMTS.

nboisteault commented 4 years ago

@guenterw Lizmap 3.1.x is not maintained anymore, you should update to 3.2.x.

lmwu commented 4 years ago

@lmwu "Get images directly from WMS Server" works with WMS not WMTS.

Hi

I just tried a variety of settings including HTTP and WMS/WMTS ways. All of them failed.

Perhaps you may give me a hand for the detail steps in configuration.

Many thanks.

guenterw commented 4 years ago

@nboisteault I know that But under Lizmap 3.1.x everything has worked with QGIS Server 2.18 for years and is very stable. I just have to keep working with QGIS 2.18.

But that's why I try to upgrade to 3.3.x.

nboisteault commented 4 years ago

@lmwu First are you able to display a WMS layer in Lizmap without "Get images directly from WMS Server" checked ?

lmwu commented 4 years ago

@lmwu First are you able to display a WMS layer in Lizmap without "Get images directly from WMS Server" checked ?

Unfortunatedly it's keeping "Server Error"

guenterw commented 4 years ago

again summarizing my test results with Lizmap 3.3.5 and QGIS server 3.12.1 under Ubuntu 18.04 lts with Apache server 2.4.29:

lmwu commented 4 years ago

OSM OSM(https) Not OSM

guenterw commented 4 years ago

correctly

http://sgx.geodatenzentrum.de/wms_topplus_web_open? is a worldwide representation and also contains OSM data

lmwu commented 4 years ago

I found ... The TW NGIS E-map seems not as the OSM with zxy tiles. Is it the reason why I cannot make it?

Just get https://wmts.nlsc.gov.tw/wmts/PHOTO2/default/GoogleMapsCompatible/{z}/{y}/{x}.jpeg

lmwu commented 4 years ago

Seems it's a question not able to resolve. I will close it and go back to use geoserver. Thank you all kindness answers with experienced share.

Gustry commented 4 years ago

Sorry, did you close this issue because you are moving back to geoserver? Or is there really a bug in QGIS Server? Or in Lizmap?

guenterw commented 4 years ago

I think the WMS service is a QGIS server or Lizmap problem. Or an error in the installation?

I also see the new behavior with missing data sources (see above) as an open question.

If the questions are not discussed further here, I will create a new issue for both.

nboisteault commented 4 years ago

Let's keep this issue opened.

rldhont commented 4 years ago

Hi all,

This issue is a QGIS Server one.

First of all, you should know that in QGIS Server 3, if a layer could not be loaded by QGIS Server, the whole project fails. Any request will return an http 500 error. The project is therefore not usable. A layer cannot be loaded if QGIS Server cannot have access to the database (unknown host, unknown user and password, unauthorized IP), or to the web service (proxy in the network, unknown host, failure SSL contact). You have to check the QGIS Server log to have the right error.

Then, you can update to LWC 3.2. with QGIS Server 2.18.. If you want to use QGIS Server 3., you have to use LWC 3.3..

The issue about SSL handcheck https://github.com/qgis/QGIS/issues/31675

@lmwu @guenterw What are your QGIS Server enviroment variables ?

guenterw commented 4 years ago

Hi @rldhont, thanks for the clarification. Especially for the WMS services, I find the QGIS server behavior not very practical. If you have integrated several WMS services in the project, one may be offline or the address may have changed without you noticing. If the whole project does not load then it is quite annoying for the user.

Is it known that there is already a change request for the QGIS server?

To the QGIS Server enviroment variables: How do I determine the current variables? Are the variables set in the Apache .conf file? I have to do some research again. Compared to my QGIS server installation 2.18, I have not defined or changed any additional variables.

I will check the problem with the SSL hand check (# 31675). Thanks a lot.

lmwu commented 4 years ago

Sorry, did you close this issue because you are moving back to geoserver? Or is there really a bug in QGIS Server? Or in Lizmap?

Yes I have to quickly establish a WebGIS/Mapping Service in an intranet, and so far the geoserver seems a more stable choice. TKS a lot!

lmwu commented 4 years ago

For me, TW NGIS WMS/WMTS can be easily to add in the QGIS as layers, without any authentication. It means, QGIS is able to load the tile images directly. How come the QGIS server cannot load them well?? (I've not been trying the http request just with qgis server, as what in its own documentation.)

lmwu commented 4 years ago

The thread seems silent again.

rldhont commented 4 years ago

Hi @lmwu What are your QGIS Server enviroment variables ?

rldhont commented 4 years ago

@lmwu @guenterw you have to defined a HOME or QGIS_CUSTOM_CONFIG_PATH environmental variable for QGIS Server. These directories has to be writable by the server user, like www-data for apache.

If you defined the HOME varaible, QGIS Server will create the directories .local/share/QGIS/QGIS3/profiles/ and the default profile with all the needed files and directories.

The variable QGIS_CUSTOM_CONFIG_PATH is equivalent to HOME+/.local/share/QGIS/QGIS3/profiles/default

The profile directory is mandatory for QGIS Server 3 to correctly works with authentication and HTTPS certificates.

guenterw commented 4 years ago

@rldhont Thanks a lot I will test it over Easter

lmwu commented 4 years ago

@lmwu @guenterw you have to defined a HOME or QGIS_CUSTOM_CONFIG_PATH environmental variable for QGIS Server. These directories has to be writable by the server user, like www-data for apache.

If you defined the HOME varaible, QGIS Server will create the directories .local/share/QGIS/QGIS3/profiles/ and the default profile with all the needed files and directories.

The variable QGIS_CUSTOM_CONFIG_PATH is equivalent to HOME+/.local/share/QGIS/QGIS3/profiles/default

The profile directory is mandatory for QGIS Server 3 to correctly works with authentication and HTTPS certificates.

Thanks and all the settings above are done. image

rldhont commented 4 years ago

@lmwu how did you configuee QGIS Server fcgi variables ?

lmwu commented 4 years ago

@lmwu how did you configuee QGIS Server fcgi variables ?

I didn't get any QGIS fcgi setting configured. Would you please teach me about it, pls!

Gustry commented 4 years ago

@lmwu He is talking about environment variables that you should set for QGIS Server : https://docs.qgis.org/3.10/en/docs/user_manual/working_with_ogc/server/config.html#environment-variables High probability that it's in your Apache or Nginx config. But for me, it's in my systemd config, I use Spawn-FCGI.

What are you using?

lmwu commented 4 years ago

@lmwu He is talking about environment variables that you should set for QGIS Server : https://docs.qgis.org/3.10/en/docs/user_manual/working_with_ogc/server/config.html#environment-variables High probability that it's in your Apache or Nginx config. But for me, it's in my systemd config, I use Spawn-FCGI.

What are you using?

Just normal FastCGI.

lmwu commented 4 years ago

I just replaced the geoserver with mapproxy and the performance is impressive. QGIS server also has the proxy, right?

lmwu commented 4 years ago

image

Gustry commented 4 years ago

@lmwu You still haven't give us your variable environment, related to this:

High probability that it's in your Apache or Nginx config. But for me, it's in my systemd config, I use Spawn-FCGI.

and

He is talking about environment variables that you should set for QGIS Server : https://docs.qgis.org/3.10/en/docs/user_manual/working_with_ogc/server/config.html#environment-variables

So please check in your webserver where you are calling fastcgi.

I just replaced the geoserver with mapproxy and the performance is impressive. QGIS server also has the proxy, right?

I'm sorry, but this thread starts to be difficult to keep track. Can you keep one topic per ticket? It depends of your settings and Lizmap has caching if you enable it.

lmwu commented 4 years ago

image The View in QGIS desktop as above. image The view with same extent in the lizmap client. Rendering the external WMS seems with trouble. BTW, the fcgi setting is in /etc/apache2/site-enable/ ,as below,

image

lmwu commented 4 years ago

Excuse me, in the log file,

================================================================
2020-04-08 18:45:50 ::1 warning 2020-04-08 18:45:50 [2] file_get_contents(http://127.0.0.1/cgi-bin/qgis_mapserv.fcgi?service=WMS&request=GetCapabilitiesAtlas&map=%2Fvar%2Fwww%2Flizmap%2Dweb%2Dclient%2D3%2E3%2E5%2Flizmap%2Finstall%2Ftest%2Fsixth%2Eqgs): failed to open stream: HTTP request failed! HTTP/1.1 501 Not Implemented
    /var/www/lizmap-web-client-3.3.5/lizmap/modules/lizmap/classes/lizmapProxy.class.php    240
==============================================================

What does this warning mean for?

gioman commented 4 years ago

Especially for the WMS services, I find the QGIS server behavior not very practical. If you have integrated several WMS services in the project, one may be offline or the address may have changed without you noticing. If the whole project does not load then it is quite annoying for the user.

Is it known that there is already a change request for the QGIS server?

this problem has been raised by others, see https://github.com/qgis/QGIS/pull/9991#issuecomment-593848956 for example

guenterw commented 4 years ago

@gioman Thanks for the hint. I am glad that this problem is also seen by others and that one is working on a solution. An optional setting, for example via an environment variable, would certainly make sense. And if this could still be controlled via the Lizmap plugin, it would be perfect.

lmwu commented 4 years ago

@gioman Thanks for the hint. I am glad that this problem is also seen by others and that one is working on a solution. An optional setting, for example via an environment variable, would certainly make sense. And if this could still be controlled via the Lizmap plugin, it would be perfect.

Perhaps so far a good idea is to activate lizmap web client with a mapproxy for external WMS service, in same server.

mdouchin commented 4 years ago

Pleae @lmwu do not use this issue as a forum thread. If you need to discuss a wide range of topics around lizmap, there is a mailing list https://lists.osgeo.org/mailman/listinfo/lizmap A QGIS issue is dedicated to one single topic (one bug or one feature request)

FYI, Lizmap has already a built-in tile caching system, and can act as a proxy for QGIS Server. No need to use mapproxy.