With Lizmap
In Lizmap, the browser cannot query QGIS Server directly: QGIS Server must stay private, and
only Lizmap knows who the user is (it tells QGIS Server with the X-Lizmap-User and
X-Lizmap-User-Groups headers, used by the lizmap_server plugin for the layer rights).
The profile requests thus go through Lizmap.
The path of the requests: the browser never queries QGIS Server directly.
So that the plugin can be reached through the Lizmap proxy, which only relays WMS, WFS and
WMTS, the requests can be sent with SERVICE=WMS: the filter of the plugin renames them
into SERVICE=PROFILE on the QGIS Server side (only GetElevationLayers and
GetElevationProfile).
What to install depends on your Lizmap:
Your Lizmap |
On QGIS Server |
In Lizmap |
|---|---|---|
The fork Seboon/lizmap-web-client |
this plugin |
nothing: the profile tool is built into the fork (Measure menu). The module is not needed. |
Official Lizmap Web Client 3.9 / 3.10 |
this plugin |
the |
Do not install the module in the fork: you would get two profile tools.
The fork Seboon/lizmap-web-client
The fork Seboon/lizmap-web-client relays both requests and has the complete profile tool in its Measure menu: several superposed curves, QGIS symbology, Copernicus, several lines, vertex editing, map and graph hover in sync.
The module for the official Lizmap
The lizmap-elevationprofile-module module brings the same tool to
the official Lizmap Web Client 3.9 and 3.10, in the bottom dock. It adds its own relay
(index.php/elevationprofile/service), with the same checks as the map: access to the
project and user identity. See its
documentation.
The profile tool in Lizmap (module or fork). Demonstration data.
Your own code
To write your own tool (JavaScript of a project, another module), send the requests to the
Lizmap proxy if it relays them, or to the relay of the module. They have the form described
in Requests and answers, with repository and project added:
const body = new URLSearchParams({
repository: lizUrls.params.repository,
project: lizUrls.params.project,
SERVICE: 'WMS',
VERSION: '1.3.0',
REQUEST: 'GetElevationLayers',
});
const layers = await (await fetch(lizUrls.wms, { method: 'POST', body })).json();
The official Lizmap does not relay these requests yet: a change has been proposed to 3Liz so
that it relays them like GetStyles.
Checking the rights
In the Lizmap administration, remove from a group the right to see an elevation layer.
Logged in as a user of this group, open the tool: the layer is not listed, and a
GetElevationProfilerequest on it answers403.
QGIS Server must not be reachable from the Internet: see Security and rights.