Requests and answers
The service is named PROFILE. The requests are accepted as GET and POST
(parameters in an application/x-www-form-urlencoded body). The parameter names are
case-insensitive.
SERVICE=WMS is also accepted for these two requests: the filter of the plugin changes it
into PROFILE (see With Lizmap).
GetElevationLayers
SERVICE=PROFILE
REQUEST=GetElevationLayers
MAP=<project> (if QGIS Server has no default project)
Answer 200, application/json: the elevation layers the user may read, in the order
of the layer tree, then Copernicus if it is enabled.
{
"result": true,
"layers": [
{
"id": "mnt_d609de4c_...",
"name": "mnt",
"title": "MNT 1 m",
"group": ["Relief", "Detail"],
"type": "raster",
"source": "project",
"default_visible": true,
"symbology": "fill_below",
"line_color": "rgba(0,0,255,1)",
"fill_color": "rgba(140,221,204,1)",
"nom": "mnt",
"has_elevation": true
},
{
"id": "copernicus_glo30",
"name": "copernicus_glo30",
"title": "Copernicus GLO-30 (DSM, online)",
"group": [],
"type": "raster",
"source": "online",
"default_visible": false,
"symbology": "fill_below",
"line_color": "rgba(214,39,40,1)",
"fill_color": "rgba(214,39,40,1)",
"attribution": "© DLR e.V. 2010-2014 and ..."
}
]
}
Field |
Meaning |
|---|---|
|
|
|
Id of the layer, to pass in |
|
Name of the layer; title to display (title of the layer, or its name in the tree). |
|
Path of its groups in the layer tree. |
|
|
|
Show by default in elevation profile plots of QGIS. For Copernicus: |
|
Profile representation in QGIS: |
|
Colours of the line and of the fill, |
|
Online sources: attribution required by the licence, to be displayed by the client. |
|
Former fields, kept for compatibility with older clients. |
GetElevationProfile
SERVICE=PROFILE
REQUEST=GetElevationProfile
GEOMETRY=x1,y1;x2,y2;...;xn,yn
LAYERS=<id>,<id>,... (ids given by GetElevationLayers)
CRS=EPSG:2154 (optional: CRS of GEOMETRY, default: the project CRS)
SAMPLES=537 (optional: number of points, instead of the step)
MAP=<project>
GEOMETRY: the polyline, at least two points, always asx,y: easting, northing, orlongitude,latitudein EPSG:4326.All the requested layers are sampled at the same points. The step is the pixel size of the finest layer, converted into the units of
CRS(a raster in degrees in a project in metres is handled correctly), capped toELEVATIONPROFILE_MAX_SAMPLESpoints.SAMPLESsets the number of points (at least 2): for the same line, the same number gives exactly the same points.
All the layers are sampled at the same points of the line: their curves are exactly superposed.
Answer 200, application/json:
{
"x": [0, 7.86, 15.72],
"coords": [[652000, 6862000], [652007.86, 6862000], [652015.72, 6862000]],
"vertices": [0, 1500, 2609.1],
"distance": "planar",
"profiles": [
{"id": "mnt_d609...", "name": "mnt", "title": "MNT 1 m", "y": [245.0, 245.4, null]}
]
}
Field |
Meaning |
|---|---|
|
Distance of each point from the start of the line, in metres, measured along the line. |
|
How the distances are computed: |
|
The points, in |
|
Distance of each vertex of |
|
Elevation of each point ( |
Original format: with LAYER=<layer name> instead of LAYERS, the answer is
{"x": [...], "y": [...], "coords": [...]} for that layer.
Errors
Any failure returns a status other than 200, with a JSON body:
{"status": "fail", "request_id": "...", "message": "human-readable reason"}
Status |
Case |
|---|---|
|
Missing or invalid parameter ( |
|
Access to the layer denied (rights, or layer excluded from the WMS publication). |
|
Layer not found. |
|
Internal error (details in the QGIS Server logs). |
request_id is the X-Request-ID header of the request, when it is given.