Feature request #21692

XYZ Tiles base map not working on QGIS Server with GetMap wms request

Added by Marco Barbieri over 5 years ago. Updated over 5 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Documentation and Help
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:29508

Description

I have a project in QGIS desktop with some XYZ Tiles base maps. Everything works fine on desktop version, that is all maps are displayed.

I use the same .qgs project on QGIS server and only some base maps work with GetMap request.

The following are my requests to the server, divided by maps that work and maps that don't work:

These maps work:

OpenStreetMap
http://qgs.webmapp.it/cgi-bin/test/qgis_mapserv.fcgi?MAP=/usr/lib/cgi-bin/test/template_xyz_tiles.qgs&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=1174461,5729736,1175761,5731386&CRS=EPSG:3857&WIDTH=491&HEIGHT=624&LAYERS=OpenStreetMap&FORMAT=image/png

Humanitarian_map:
http://qgs.webmapp.it/cgi-bin/test/qgis_mapserv.fcgi?MAP=/usr/lib/cgi-bin/test/template_xyz_tiles.qgs&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=1174461,5729736,1175761,5731386&CRS=EPSG:3857&WIDTH=491&HEIGHT=624&LAYERS=Humanitarian_map&FORMAT=image/png

OpenCycleMap
http://qgs.webmapp.it/cgi-bin/test/qgis_mapserv.fcgi?MAP=/usr/lib/cgi-bin/test/template_xyz_tiles.qgs&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=1174461,5729736,1175761,5731386&CRS=EPSG:3857&WIDTH=491&HEIGHT=624&LAYERS=OpenCycleMap&FORMAT=image/png

Stamen_Terrain
http://qgs.webmapp.it/cgi-bin/test/qgis_mapserv.fcgi?MAP=/usr/lib/cgi-bin/test/template_xyz_tiles.qgs&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=1174461,5729736,1175761,5731386&CRS=EPSG:3857&WIDTH=491&HEIGHT=624&LAYERS=Stamen_Terrain&FORMAT=image/png

These maps don't work:

WebMapp_Tiles
http://qgs.webmapp.it/cgi-bin/test/qgis_mapserv.fcgi?MAP=/usr/lib/cgi-bin/test/template_xyz_tiles.qgs&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=1174461,5729736,1175761,5731386&CRS=EPSG:3857&WIDTH=491&HEIGHT=624&LAYERS=WebMapp_Tiles&FORMAT=image/png

WikimediaMaps
http://qgs.webmapp.it/cgi-bin/test/qgis_mapserv.fcgi?MAP=/usr/lib/cgi-bin/test/template_xyz_tiles.qgs&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=1174461,5729736,1175761,5731386&CRS=EPSG:3857&WIDTH=491&HEIGHT=624&LAYERS=WikimediaMaps&FORMAT=image/png

WaymarkedTrails
http://qgs.webmapp.it/cgi-bin/test/qgis_mapserv.fcgi?MAP=/usr/lib/cgi-bin/test/template_xyz_tiles.qgs&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=1174461,5729736,1175761,5731386&CRS=EPSG:3857&WIDTH=491&HEIGHT=624&LAYERS=WaymarkedTrails&FORMAT=image/png

On desktop (MacOS) I have installed QGIS 3.4.5-Madeira
On the server (Debian) I have installed 3.4.5+14stretch

Please find in attachment the Qgis project file.

template_xyz_tiles.qgs (34.8 KB) Marco Barbieri, 2019-03-28 07:09 PM

template_xyz_tiles.zip (5.69 KB) Paolo Cavallini, 2019-04-01 08:15 AM

History

#1 Updated by Giovanni Manghi over 5 years ago

  • Category changed from Web Services clients/XYZ to QGIS Server

#2 Updated by Paolo Cavallini over 5 years ago

I confirm the issue, see attached project.

#3 Updated by René-Luc ReLuc over 5 years ago

In the example provided by Paolo, the working layers are in HTTP the others are in HTTPS.

To fix it, you have to update QGIS2.ini or QGIS3.ini to configure the proxy section.

[proxy]
proxyEnabled=true
proxyHost=
proxyPort=8080
proxyUser=
proxyPassword=
proxyType=HttpProxy
proxyExcludedUrls=

And to add QGIS_OPTIONS_PATH in the server configuration to provide the directory in which QGIS Server wil find QGIS2.ini or QGIS3.ini

I think the QGIS docs could be updated.

#4 Updated by Giovanni Manghi over 5 years ago

René-Luc ReLuc wrote:

In the example provided by Paolo, the working layers are in HTTP the others are in HTTPS.

To fix it, you have to update QGIS2.ini or QGIS3.ini to configure the proxy section.

[proxy]
proxyEnabled=true
proxyHost=
proxyPort=8080
proxyUser=
proxyPassword=
proxyType=HttpProxy
proxyExcludedUrls=

And to add QGIS_OPTIONS_PATH in the server configuration to provide the directory in which QGIS Server wil find QGIS2.ini or QGIS3.ini

I think the QGIS docs could be updated.

this is an important "tip", we should file a ticket in the documentation repository to not forget about adding it.

#5 Updated by Paolo Cavallini over 5 years ago

Unfortunately, it still does not work; from apache2 error log:

QSqlDatabasePrivate::database: unable to open database: "unable to open database file Error opening database" 
ERROR: Opening of authentication db FAILED
QSqlQuery::prepare: database not open
WARNING: Auth db query exec() FAILED

#6 Updated by Paolo Cavallini over 5 years ago

  • Category changed from QGIS Server to Documentation and Help
  • Tracker changed from Bug report to Feature request

Solved:

mkdir /var/www/authdb
chown www-data /var/www/authdb
/etc/apache2/mods-enabled/fcgid.conf
FcgidInitialEnv QGIS_AUTH_DB_DIR_PATH /var/www/authdb/
service apache2 restart

Documentation should be updated.

Also available in: Atom PDF