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

result

true if there is at least one layer.

id

Id of the layer, to pass in LAYERS.

name, title

Name of the layer; title to display (title of the layer, or its name in the tree).

group

Path of its groups in the layer tree.

source

project (layer of the project) or online (Copernicus).

default_visible

Show by default in elevation profile plots of QGIS. For Copernicus: true only if the project has no elevation layer.

symbology

Profile representation in QGIS: line, fill_below or fill_above.

line_color, fill_color

Colours of the line and of the fill, rgba(r,g,b,a), or null.

attribution

Online sources: attribution required by the licence, to be displayed by the client.

nom, has_elevation

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 as x,y: easting, northing, or longitude,latitude in 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 to ELEVATIONPROFILE_MAX_SAMPLES points.

  • SAMPLES sets 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

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

x

Distance of each point from the start of the line, in metres, measured along the line.

distance

How the distances are computed: planar in a projected CRS (like QGIS Desktop), ellipsoidal in a geographic CRS and in Pseudo-Mercator (EPSG:3857), whose planar distances are strongly stretched away from the equator.

coords

The points, in CRS.

vertices

Distance of each vertex of GEOMETRY.

profiles[].y

Elevation of each point (null where the layer has no value), band, Z scale and Z offset applied.

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

400

Missing or invalid parameter (GEOMETRY, CRS, SAMPLES, REQUEST), or layer that is not an elevation layer.

403

Access to the layer denied (rights, or layer excluded from the WMS publication).

404

Layer not found.

500

Internal error (details in the QGIS Server logs).

request_id is the X-Request-ID header of the request, when it is given.