Responsive background maps with QGIS Cloud
Sourcepole QGIS Cloud is a great and convenient way to publish geodata as webmaps, to have a database and to manage everything from the desktop GIS. No need to run and maintain a server.
Today our topic is handling of background maps in QGIS Cloud. QGIS Cloud maps are normally WMS maps delivered by QGIS Server. However most maps consist of a foreground (vector) theme and a background raster layer. The background raster layer typically comes from a service like WMS, WMTS, OpenStreetMap, Bing, Google. If the foreground and the background both come as one WMS from QGIS Server, the published web map is usually slow and unresponsive. If the background map comes directly to the web map and only the foreground comes as WMS, the webmap is much faster and responsive. Therefore, we recently improved the handling of background layers in QGIS Cloud. When a project is published, we try to detect which layers are background layers and can be loaded directly in the webmap. QGIS Cloud also considers that these layers still need to be cascaded over QGIS Server for printing.
Currently WMS, WMTS, OpenStreetMap, Bing, Google are supported as background layers. Keep in mind that background layers can only be directly displayed in the webmap if the raster background layer CRS matches the map CRS (not on-the-fly reprojected). E.g. if we add an OpenStreetMap, Bing, Google background (as xyz-Layer from the browser or with the Quickmap plugin), the map CRS should be set to EPSG:3857. Otherwise, QGIS server needs to reproject the OSM tiles and this is very slow for each zoom or pan operation.
The following two examples illustrate this difference. We have hiking trails as foreground theme and an OSM background map.
The map CRS of the first map published to QGIS Cloud is set to EPSG:3857, so the OSM tiles can be treated as background layers and are coming directly to the webmap:
Good: background comes directly to the webmap
In the second map, we’ve added the OSM background layer in QGIS and forgot to switch the map CRS from EPSG:2056 (layer CRS of the hiking trails) to EPSG:3857 (CRS of OSM tiles). Therefore the OSM tiles are cascaded via QGIS server and reprojected. The webmap is slow and unresponsive:
Bad: background comes cascaded over QGIS Server to the webmap
For maps with WMS/WMTS backgrounds, the map CRS should be set to one which is supported by the WMS/WMTS server.
Looking forward to see many maps on QGIS Cloud with fast background layers!