Important

Translation is a community effort you can join. This page is currently translated at 53.58%.

3.2. Web Map Service (WMS)

Les normes WMS 1.1.1 et 1.3.0 mises en œuvre dans QGIS Server fournissent une interface HTTP pour demander des images de cartes ou de légendes générées à partir d’un projet QGIS. Une requête WMS typique définit le projet QGIS à utiliser, les couches à rendre ainsi que le format d’image à générer. Un support de base est également disponible pour les Styled Layer Descriptor (SLD).

Spécifications :

Requêtes standard fournies par QGIS Server :

Requête

Description

GetCapabilities

Renvoie des métadonnées XML avec des informations sur le serveur

GetMap

Renvoie une carte

GetFeatureInfo

Récupère les données (géométrie et valeurs) pour un emplacement de pixel

GetLegendGraphic

Renvoie les symboles de légende

GetStyle(s)

Renvoie un document XML avec la description du style en SLD

DescribeLayer

Returns information about WFS and WCS availability respectively for vector and raster layers

Demandes des fournisseurs fournies par QGIS Server:

Requête

Description

GetPrint

Renvoie une mise en page QGIS

GetProjectSettings

Renvoie des informations spécifiques sur QGIS Server

GetSchemaExtension

Returns XML metadata about optional extended capabilities

3.2.1. GetCapabilities

Standard parameters for the GetCapabilities request according to the OGC WMS 1.1.1 and 1.3.0 specifications:

Paramètre

Requis

Description

SERVICE

Oui

Nom du service (WMS)

REQUEST

Oui

Nom de la requête (GetCapabilities)

VERSION

Non

Version du service

The GetCapabilities request supports as well the following vendor parameters:

Paramètre

Requis

Description

MAP

Oui

Fichier du projet QGIS

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetCapabilities

3.2.2. GetMap

Paramètres standard pour la requête GetMap selon les spécifications OGC WMS 1.1.1 et 1.3.0 :

Paramètre

Requis

Description

SERVICE

Oui

Nom du service (WMS)

REQUEST

Oui

Nom de la requete (GetMap)

VERSION

Oui

Version du service

LAYERS

Non

Couches à afficher

STYLES

Non

Style des couches

SRS / CRS

Oui

Système de coordonnées de référence

BBOX

Oui

Emprise de la carte

WIDTH

Oui

Largeur de l’image en pixels

HEIGHT

Oui

Hauteur de l’image en pixels

FORMAT

Non

Format de l’image

TRANSPARENT

Non

Arrière-plan transparent

SLD

Non

URL d’un SLD à utiliser pour la symbologie

SLD_BODY

Non

Contenu de SLD (XML) à utiliser pour la symbologie

In addition to the standard ones, QGIS Server supports redlining, external WMS layers as well as the following extra parameters:

Paramètre

Requis

Description

MAP

Oui

Fichier du projet QGIS

BGCOLOR

Non

Spécifiez la couleur d’arrière-plan

DPI

Non

Spécifiez la résolution de sortie

IMAGE_QUALITY

Non

Compression JPEG

OPACITIES

Non

Opacité pour une couche ou un groupe

FILTER

Non

Sous-ensemble d’entités

SELECTION

Non

Mettre en évidence d’entités

FILE_NAME

Non

Nom du fichier téléchargé

Seulement pour FORMAT=application/dxf

FORMAT_OPTIONS

Non

Options du format de fichier spécifié

Seulement pour FORMAT=application/dxf

TILED

Non

Travailler en mode tuile

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetMap
&MAP=/home/qgis/projects/world.qgs
&LAYERS=mylayer1,mylayer2,mylayer3
&STYLES=style1,default,style3
&OPACITIES=125,200,125
&CRS=EPSG:4326
&WIDTH=400
&HEIGHT=400
&FORMAT=image/png
&TRANSPARENT=TRUE
&DPI=300
&TILED=TRUE

VERSION

Ce paramètre permet de spécifier la version du service à utiliser. Les valeurs disponibles pour le paramètre VERSION sont:

  • 1.1.1

  • 1.3.0

Selon le numéro de version, de légères différences sont à prévoir comme expliqué plus loin pour les paramètres suivants:

  • CRS / SRS

  • BBOX

LAYERS

Ce paramètre permet de spécifier les couches à afficher sur la carte. Les noms doivent être séparés par une virgule.

De plus, QGIS Server a introduit certaines options pour sélectionner des couches en:

  • the layer id: the project option allowing to select layers by their id is in QGIS Server ► WMS tab of the Project ► Properties… dialog. Check the Use layer ids as names checkbox to activate this option.

  • un nom court

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetMap
&LAYERS=mylayerid1,mylayerid2
&...

STYLES

Ce paramètre peut être utilisé pour spécifier le style d’une couche pour l’étape de rendu. Les styles doivent être séparés par une virgule. Le nom du style par défaut est default.

SRS / CRS

Ce paramètre permet d’indiquer le système de référence spatiale de la sortie de la carte dans WMS 1.1.1 et doit être formé comme EPSG:XXXX. Notez que CRS est également supporté si la version actuelle est 1.1.1.

Pour WMS 1.3.0, le paramètre CRS est préférable mais SRS est également pris en charge.

Notez que si les paramètres CRS et SRS sont indiqués dans la demande, c’est la version actuelle indiquée dans le paramètre VERSION qui est déterminante.

Dans le cas suivant, le paramètre SRS est conservé quel que soit le paramètre VERSION car CRS n’est pas indiqué:

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetMap
&VERSION=1.3.0
&SRS=EPSG:2854
&...

Dans le cas suivant, le paramètre SRS est conservé au lieu de CRS à cause du paramètre VERSION:

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetMap
&VERSION=1.1.1
&CRS=EPSG:4326
&SRS=EPSG:2854
&...

Dans le cas suivant, le paramètre CRS est conservé au lieu de SRS à cause du paramètre VERSION:

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetMap
&VERSION=1.3.0
&CRS=EPSG:4326
&SRS=EPSG:2854
&...

BBOX

Ce paramètre permet de spécifier l’étendue de la carte avec des unités en fonction du SCR actuel. Les coordonnées doivent être séparées par une virgule.

Le paramètre BBOX est formé par min_a,min_b,max_a,max_b mais les axes a et``b`` peuvent varier en fonction du paramètre actuel de VERSION

  • En WMS 1.1.1, l’ordre des axes est toujours est/nord

  • En WMS 1.3.0, l’ordre des axes dépend du SCR

Par exemple, dans le cas d’un SCR EPSG:4326 et du protocole WMS en version 1.1.1, a est la longitude (est) et b la latitude (nord), la requête est donc la suivante :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetMap
&VERSION=1.1.1
&SRS=epsg:4326
&BBOX=-180,-90,180,90
&...

Mais dans le cas du protocole WMS en version 1.3.0, l’ordre des axes définis dans la base EPSG est nord/est donc a est la latitude et b la longitude :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetMap
&VERSION=1.3.0
&CRS=epsg:4326
&BBOX=-90,-180,90,180
&...

WIDTH

Ce paramètre permet de spécifier la largeur en pixels de l’image de sortie.

HEIGHT

Ce paramètre permet de spécifier la hauteur en pixels de l’image de sortie.

FORMAT

Ce paramètre peut être utilisé pour spécifier le format de l’image de la carte. Les valeurs disponibles sont:

  • jpg

  • jpeg

  • image/jpeg

  • image/png

  • image/png; mode=1bit

  • image/png; mode=8bit

  • image/png; mode=16bit

  • image/webp

  • application/dxf: only layers that have read access in the WFS service are exported in the DXF format

    Exemple d’URL :

    http://localhost/qgisserver?
    SERVICE=WMS&VERSION=1.3.0
    &REQUEST=GetMap
    &FORMAT=application/dxf
    &LAYERS=Haltungen,Normschacht,Spezialbauwerke
    &CRS=EPSG%3A21781
    &BBOX=696136.28844801,245797.12108743,696318.91114315,245939.25832905
    &WIDTH=1042
    &HEIGHT=811
    &FORMAT_OPTIONS=MODE:SYMBOLLAYERSYMBOLOGY;SCALE:250
    &FILE_NAME=plan.dxf
    

TRANSPARENT

Ce paramètre booléen peut être utilisé pour spécifier la transparence d’arrière-plan. Les valeurs disponibles sont (non sensibles à la casse):

  • TRUE

  • FALSE

However, this parameter is ignored if the format of the image indicated with FORMAT is different from PNG.

BGCOLOR

Ce paramètre permet d’indiquer une couleur de fond pour l’image de la carte. Cependant, il ne peut pas être combiné avec le paramètre TRANSPARENT dans le cas d’images PNG (la transparence est prioritaire). La couleur peut être littérale ou en notation hexadécimale.

Exemple d’URL avec la notation littérale:

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetMap
&VERSION=1.3.0
&BGCOLOR=green
&...

Exemple d’URL avec la notation hexadécimale:

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetMap
&VERSION=1.3.0
&BGCOLOR=0x00FF00
&...

DPI

Ce paramètre peut être utilisé pour spécifier la résolution de sortie demandée.

IMAGE_QUALITY

Ce paramètre n’est utilisé que pour les images JPEG. Par défaut, la compression JPEG est -1.

Vous pouvez modifier la valeur par défaut par projet QGIS dans le menu OWS Server -> WMS capabilities du menu Projet -> Proprietes … `. Si vous souhaitez le remplacer dans une demande ``GetMap`, vous pouvez le faire en utilisant le paramètre IMAGE_QUALITY.

OPACITIES

Comma separated list of opacity values. Opacity can be set on layer or group level. Allowed values range from 0 (fully transparent) to 255 (fully opaque).

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetMap
&VERSION=1.3.0
&WIDTH=400
&HEIGHT=200
&CRS=EPSG:4326
&LAYERS=countries,places
&BBOX=42,-6,52,15
&OPACITIES=255,0
../../../_images/wms_getmap_opacities.png

Fig. 3.2 To the left OPACITIES=255,0 and to the right OPACITIES=255,255

FILTER

Un sous-ensemble de couches peut être sélectionné avec le paramètre FILTER. La syntaxe est fondamentalement la même que pour la chaîne de sous-ensemble QGIS. Cependant, il existe certaines restrictions pour éviter les injections SQL dans les bases de données via QGIS Server. Si une chaîne dangereuse est trouvée dans le paramètre, QGIS Server renverra l’erreur suivante:

<ServiceExceptionReport>
  <ServiceException code="Security">The filter string XXXXXXXXX has been rejected because of security reasons.
  Note: Text strings have to be enclosed in single or double quotes. A space between each word / special character is mandatory.
  Allowed Keywords and special characters are IS,NOT,NULL,AND,OR,IN,=,<,=<,>,>=,!=,',',(,),DMETAPHONE,SOUNDEX.
  Not allowed are semicolons in the filter expression.</ServiceException>
</ServiceExceptionReport>

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetMap
&VERSION=1.3.0
&WIDTH=400
&HEIGHT=300
&CRS=EPSG:4326
&BBOX=41,-6,52,10
&LAYERS=countries_shapeburst,countries,places
&FILTER=countries_shapeburst,countries:"name" = 'France';places: "name" = 'Paris'
../../../_images/wms_getmap_filter.png

Fig. 3.3 Server response to a GetMap request with FILTER parameter

In this example, the same filter "name" = 'France' is applied to layers countries and countries_shapeburst, while the filter "name" = 'Paris' is only applied to places.

Note

Il est possible d’effectuer des recherches d’attributs via GetFeatureInfo et d’omettre le paramètre X / Y si un FILTRE est là. QGIS Server renvoie ensuite des informations sur les entités correspondantes et génère un cadre de délimitation combiné dans la sortie XML.

SELECTION

Le paramètre SELECTION peut mettre en évidence les entités d’une ou plusieurs couches. Les entités vectorielles peuvent être sélectionnées en passant des listes séparées par des virgules avec des identifiants d’entités.

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetMap
&LAYERS=mylayer1,mylayer2
&SELECTION=mylayer1:3,6,9;mylayer2:1,5,6
&...

L’image suivante présente la réponse d’une demande GetMap en utilisant l’option SELECTION par ex. http: //myserver.com/...&SELECTION=countries: 171,65.

Comme ces identifiants d’entités correspondent dans l’ensemble de données source à France et Roumanie, ils sont surlignés en jaune.

../../../_images/server_selection_parameter.png

Fig. 3.4 Réponse du serveur à une demande GetMap avec le paramètre SELECTION

FORMAT_OPTIONS

This parameter can be used to specify options for the selected format. Only for FORMAT=application/dxf in GetMap request. Takes a list of key:value pairs separated by semicolon:

  • ÉCHELLE: à utiliser pour les règles de symbologie, les filtres et les styles (pas la mise à l’échelle réelle des données - les données restent à l’échelle d’origine).

  • MODE: correspond aux options d’exportation proposées dans la boîte de dialogue d’exportation QGIS Desktop DXF. Les valeurs possibles sont NOSYMBOLOGY, FEATURESYMBOLOGY et SYMBOLLAYERSYMBOLOGY.

  • LAYERATTRIBUTES: specify a field or in case of many layers a comma separated list of fields that contains values for DXF layer names - if not specified, the original QGIS layer names are used.

  • USE_TITLE_AS_LAYERNAME: si activé, le titre de la couche sera utilisé comme nom de la couche.

  • CODEC: spécifiez un codec à utiliser pour l’encodage. La valeur par défaut est ISO-8859-1, vérifiez la boîte de dialogue d’exportation DXF du bureau QGIS pour les valeurs valides.

  • NO_MTEXT : Utilisez TEXT au lieu de MTEXT pour les étiquettes.

  • FORCE_2D : Force la sortie 2D. Ceci est nécessaire pour la largeur de la polyligne.

TILED

Pour des raisons de performance, QGIS server peut être utilisé en mode « tiled ». Dans ce mode, le client demande plusieurs petites tuiles de taille fixe, et les assemblent pour former la carte entière. Ce faisant, les symboles à la limite ou près de la limite entre deux tuiles peuvent apparaître coupés, car ils ne sont présents que dans une des tuiles.

Mettez le paramètre TILED à TRUE pour indiquer au logiciel QGIS Server de travailler en mode tiled, et d’appliquer le Tile buffer configuré dans le projet QGIS (voir Configurer votre projet).

Lorsque TILED est VRAI et lorsqu’un tampon de tuile différent de zéro est configuré dans le projet QGIS, les entités en dehors de l’étendue de tuile sont dessinées pour éviter les symboles coupés aux limites des tuiles.

TILED est par défaut FALSE.

3.2.3. GetFeatureInfo

Paramètres standard pour la requête GetFeatureInfo selon les spécifications OGC WMS 1.1.1 et 1.3.0 :

Paramètre

Requis

Description

SERVICE

Oui

Nom du service (WMS)

REQUEST

Oui

nom de la requete (GetFeatureInfo)

VERSION

Non

Version du service

QUERY_LAYERS

Oui

Couches à interroger

LAYERS

Oui

Couches de données à afficher (identique à QUERY_LAYERS)

STYLES

Non

Style des couches

SRS / CRS

Oui

Système de coordonnées de référence

BBOX

Non

Emprise de la carte

WIDTH

Oui

Largeur de l’image en pixels

HEIGHT

Oui

Hauteur de l’image en pixels

TRANSPARENT

Non

Arrière-plan transparent

INFO_FORMAT

Non

Format de sortie

FEATURE_COUNT

Non

Nombre maximum d’entités à renvoyer

I

Non

Colonne de pixels du point à interroger

X

Non

Identique au paramètre I, mais dans WMS 1.1.1

J

Non

Ligne de pixels du point à interroger

Y

Non

Identique au paramètre J, mais dans WMS 1.1.1

WMS_PRECISION

Non

La précision (nombre de chiffres) à utiliser lors du retour de la géométrie (voir comment ajouter une géométrie à une entité). La valeur par défaut est « -1 », ce qui signifie que la précision définie dans le projet est utilisée.

In addition to the standard ones, QGIS Server supports the following extra parameters:

Paramètre

Requis

Description

MAP

Oui

Fichier du projet QGIS

FILTER

Non

Sous-ensemble d’entités

FI_POINT_TOLERANCE

Non

Tolérance en pixels pour les couches de points

FI_LINE_TOLERANCE

Non

Tolérance en pixels pour les couches de lignes

FI_POLYGON_TOLERANCE

Non

Tolérance en pixels pour les couches de polygones

FILTER_GEOM

Non

Filtrage géométrique

WITH_DISPLAY_NAME

Non

Add the feature display name to the output

WITH_MAPTIP

Non

Ajouter des conseils de carte à la sortie

WITH_GEOMETRY

Non

Ajouter une géométrie à la sortie

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetMap
&MAP=/home/qgis/projects/world.qgs
&LAYERS=mylayer1,mylayer2,mylayer3
&CRS=EPSG:4326
&WIDTH=400
&HEIGHT=400
&INFO_FORMAT=text/xml
&TRANSPARENT=TRUE
&QUERY_LAYERS=mylayer1
&FEATURE_COUNT=3
&I=250
&J=250

INFO_FORMAT

Ce paramètre peut être utilisé pour spécifier le format du résultat. Les valeurs disponibles sont:

  • text/xml

  • text/html

  • text/plain

  • application/vnd.ogc.gml

  • application/json

QUERY_LAYERS

Ce paramètre spécifie les couches à afficher sur la carte. Les noms sont séparés par une virgule.

De plus, QGIS Server introduit des options pour sélectionner des couches en:

  • nom court

  • identifiant de couche

See the LAYERS parameter defined in GetMap for more information.

FEATURE_COUNT

This parameter specifies the maximum number of features per layer to return. For example if QUERY_LAYERS is set to layer1,layer2 and FEATURE_COUNT is set to 3 then a maximum of 3 features from layer1 will be returned. Likewise a maximum of 3 features from layer2 will be returned.

Par défaut, une seule entité par couche est renvoyée.

I

Ce paramètre, défini dans WMS 1.3.0, vous permet de spécifier la colonne de pixels du point de requête.

X

Même paramètre que I, mais défini dans WMS 1.1.1.

J

Ce paramètre, défini dans WMS 1.3.0, vous permet de spécifier la ligne de pixels du point de requête.

Y

Même paramètre que J, mais défini dans WMS 1.1.1.

FI_POINT_TOLERANCE

Ce paramètre spécifie la tolérance en pixels pour les couches de points.

FI_LINE_TOLERANCE

Ce paramètre spécifie la tolérance en pixels pour les couches de lignes.

FI_POLYGON_TOLERANCE

Ce paramètre spécifie la tolérance en pixels pour les couches de polygones.

FILTER_GEOM

Ce paramètre spécifie une géométrie WKT avec laquelle les entités doivent se croiser.

WITH_DISPLAY_NAME

This parameter specifies whether to add feature display name to the output.

Les valeurs disponibles sont (non sensibles à la casse):

  • TRUE

  • FALSE

WITH_MAPTIP

Ce paramètre spécifie s’il faut ajouter des infobulles à la sortie.

Les valeurs disponibles sont (non sensibles à la casse):

  • TRUE

  • FALSE

WITH_GEOMETRY

Ce paramètre spécifie s’il faut ajouter des géométries à la sortie. Pour l’utiliser, il vous faut d’abord activer l’option Ajouter la géométrie à la réponse d’une entité dans le projet QGIS. Voir Configurer son projet.

Les valeurs disponibles sont (non sensibles à la casse):

  • TRUE

  • FALSE

3.2.4. GetLegendGraphic

Standard parameters for the GetLegendGraphic request according to the OGC WMS 1.1.1 and 1.3.0 specifications:

Paramètre

Requis

Description

SERVICE

Oui

Nom du service (WMS)

REQUEST

Oui

Nom de la requête (GetLegendGraphic)

VERSION

Non

Version du service

LAYERS

Oui

Couches à afficher

STYLES

Non

Style des couches

SRS / CRS

Non

Système de coordonnées de référence

BBOX

Non

Emprise de la carte

WIDTH

Non

Largeur de l’image en pixels

HEIGHT

Non

Hauteur de l’image en pixels

FORMAT

Non

Format de légende

TRANSPARENT

Non

Arrière-plan transparent

In addition to the standard ones, QGIS Server supports extra parameters to change the size of the legend elements or the font properties for layer titles and item labels:

Paramètre

Requis

Description

MAP

Oui

Fichier du projet QGIS

SRCWIDTH

Non

Largeur de carte

SRCHEIGHT

Non

Hauteur de carte

SHOWFEATURECOUNT

Non

Ajouter le décompte aux entités

RULE

Non

Rule symbol to render

RULELABEL

Non

Item labels rendering

BOXSPACE

Non

Space between legend frame and content (mm)

LAYERSPACE

Non

Vertical space between layers (mm)

LAYERTITLESPACE

Non

Vertical space between layer title and items (mm)

SYMBOLSPACE

Non

Vertical space between symbol and items (mm)

ICONLABELSPACE

Non

Horizontal space between symbol and label (mm)

SYMBOLWIDTH

Non

Width of the symbol preview (mm)

SYMBOLHEIGHT

Non

Height of the symbol preview (mm)

LAYERTITLE

Non

Layer title rendering

LAYERFONTFAMILY

Non

Layer font family

LAYERFONTBOLD

Non

Layer title bold rendering

LAYERFONTSIZE

Non

Layer title font size (pt)

LAYERFONTITALIC

Non

Layer title italic rendering

LAYERFONTCOLOR

Non

Layer title color

ITEMFONTFAMILY

Non

Item font family

ITEMFONTBOLD

Non

Item label bold rendering

ITEMFONTSIZE

Non

Item label font size (pt)

ITEMFONTITALIC

Non

Item label italic rendering

ITEMFONTCOLOR

Non

Item label color

ADDLAYERGROUPS

Non

Adds the layer groups to JSON output

BBOX

This parameter can be used to specify the geographical area for which the legend should be built (its format is described here) but cannot be combined with the RULE parameter. The SRS/CRS parameter becomes mandatory when using the BBOX parameter.

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=countries,airports
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326

Note

When the BBOX parameter is defined, the legend is referred to as a content based legend.

WIDTH

This parameter is not used by default but becomes mandatory when the RULE parameter is set. In this case it allows to specify the width in pixels of the output image.

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=getlegendgraphic
&LAYER=testlayer%20%C3%A8%C3%A9
&RULE=rule1
&WIDTH=30
&HEIGHT=30

HEIGHT

This parameter is not used by default but becomes mandatory when the RULE parameter is set. In this case it allows to specify the height in pixels of the output image.

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYER=testlayer%20%C3%A8%C3%A9
&RULE=rule1
&WIDTH=30
&HEIGHT=30

FORMAT

This parameter may be used to specify the format of legend image. Available values are:

  • image/jpeg

  • image/png

  • application/json

For JSON, symbols are encoded with Base64 and most other options related to layout or fonts are not taken into account because the legend must be built on the client side. The RULE parameter cannot be combined with this format.

URL example with the corresponding JSON output:

http://localhost/qgisserver?
SERVICE=WMS&
REQUEST=GetLegendGraphic&
LAYERS=airports&
FORMAT=application/json

And the corresponding JSON output:

{
  "nodes":[
    {
      "icon":"<base64 icon>",
      "title":"airports",
      "type":"layer"
    }
  ],
  "title":""
}

SRCWIDTH

This parameter may de defined when the RULE parameter is set. In this case, the SRCWIDTH value is forwarded to the underlying GetMap request as the WIDTH parameter while the WIDTH parameter of GetLegendGraphic is used for the image legend size.

SRCHEIGHT

This parameter may de defined when the RULE parameter is set. In this case, the SRCHEIGHT value is forwarded to the underlying GetMap request as the HEIGHT parameter while the HEIGHT parameter of GetLegendGraphic is used for the image legend size.

SHOWFEATURECOUNT

This parameter can be used to activate feature count in the legend. Available values are (not case sensitive):

  • TRUE

  • FALSE

Par exemple:

../../../_images/getfeaturecount_legend.png

RULE

This parameter is available on layers with Rule-based rendering and allows to build a legend with only the named rule symbol. It cannot be combined with BBOX parameter nor the JSON format. HEIGHT and WIDTH must be specified.

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=mylayer,
&RULE=myrulename,
&WIDTH=20,
&HEIGHT=20

RULELABEL

This parameter allows to control the item label rendering. Available values are (not case sensitive):

  • TRUE : affiche l’étiquette de l’élément

  • FALSE : cache l’étiquette de l’élément

  • AUTO : cache l’étiquette de l’élément pour les couches ayant un rendu de type Symbole unique

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=countries,airports
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&RULELABEL=AUTO
../../../_images/wms_getlegendgraphic_rulelabel.png

Fig. 3.5 Legend rendering without label for single symbol layers

BOXSPACE

This parameter allows to specify the space between legend frame and content in millimeters. By default, the space value is 2 mm.

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=airports
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&BOXSPACE=0
../../../_images/wms_getlegendgraphic_boxspace.png

Fig. 3.6 To the left BOXSPACE=0 and to the right BOXSPACE=15

LAYERSPACE

This parameter allows to specify the vertical space between layers in millimeters. By default, the space value is 3 mm.

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=airports,places
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&LAYERSPACE=0
../../../_images/wms_getlegendgraphic_layerspace.png

Fig. 3.7 To the left LAYERSPACE=0 and to the right LAYERSPACE=10

LAYERTITLESPACE

This parameter allows to specify the vertical space between layer title and items following in millimeters. By default the space value is 3 mm.

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=airports,places
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&LAYERTITLESPACE=0
../../../_images/wms_getlegendgraphic_layertitlespace.png

Fig. 3.8 To the left LAYERTITLESPACE=0 and to the right LAYERTITLESPACE=10

SYMBOLSPACE

This parameter allows to specify the vertical space between symbol and item following in millimeters. By default the space value is 2 mm.

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=countries
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&SYMBOLSPACE=0
../../../_images/wms_getlegendgraphic_symbolspace.png

Fig. 3.9 To the left SYMBOLSPACE=0 and to the right SYMBOLSPACE=5

ICONLABELSPACE

This parameter allows to specify the horizontal space between symbol and label text in millimeters. By default the space value is 2 mm.

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=getlegendgraphic
&LAYERS=countries,
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&ICONLABELSPACE=0
../../../_images/wms_getlegendgraphic_iconlabelspace.png

Fig. 3.10 To the left ICONLABELSPACE=0 and to the right ICONLABELSPACE=10

SYMBOLWIDTH

This parameter allows to specify the width of the symbol preview in millimeters. By default the width value is 7 mm.

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=countries,
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&SYMBOLWIDTH=2
../../../_images/wms_getlegendgraphic_symbolwidth.png

Fig. 3.11 To the left SYMBOLWIDTH=2 and to the right SYMBOLWIDTH=20

SYMBOLHEIGHT

This parameter allows to specify the height of the symbol preview in millimeters. By default the height value is 4 mm.

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=countries,
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&SYMBOLHEIGHT=2
../../../_images/wms_getlegendgraphic_symbolheight.png

Fig. 3.12 To the left SYMBOLHEIGHT=2 and to the right SYMBOLHEIGHT=6

LAYERTITLE

This parameter specifies whether to render layer title.

Les valeurs disponibles sont (non sensibles à la casse):

  • TRUE (valeur par défaut)

  • FALSE

LAYERFONTFAMILY

This parameter specifies the font family to use for rendering layer title.

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=countries
&LAYERFONTFAMILY=monospace

LAYERFONTBOLD

This parameter specifies whether the layer title is rendered in bold. Available values are (not case sensitive):

  • TRUE

  • FALSE

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=airports,places
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&LAYERFONTBOLD=TRUE
../../../_images/wms_getlegendgraphic_layerfontbold.png

Fig. 3.13 Légende avec LAYERFONTBOLD=TRUE

LAYERFONTSIZE

This parameter specifies the font size for rendering layer title in point.

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=airports,places
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&LAYERFONTSIZE=20
../../../_images/wms_getlegendgraphic_layerfontsize.png

Fig. 3.14 Légende avec LAYERFONTSIZE=20

LAYERFONTITALIC

This parameter specifies whether the layer title is rendered in italic. Available values are (not case sensitive):

  • TRUE

  • FALSE

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=airports,places
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&LAYERFONTITALIC=TRUE
../../../_images/wms_getlegendgraphic_layerfontitalic.png

Fig. 3.15 Légende avec LAYERFONTITALIC=TRUE

LAYERFONTCOLOR

This parameter specifies the layer title color. The color may be literal (red, green, ..) or in hexadecimal notation (0xFF0000, 0x00FF00, …).

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=airports,places
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&LAYERFONTCOLOR=0x5f9930
../../../_images/wms_getlegendgraphic_layerfontcolor.png

Fig. 3.16 Légende avec LAYERFONTCOLOR=0x5f9930

ITEMFONTFAMILY

This parameter specifies the font family to use for rendering item label.

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=countries
&ITEMFONTFAMILY=monospace

ITEMFONTBOLD

This parameter specifies whether the item label is rendered in bold. Available values are (not case sensitive):

  • TRUE

  • FALSE

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=airports,places
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&ITEMFONTBOLD=TRUE
../../../_images/wms_getlegendgraphic_itemfontbold.png

Fig. 3.17 Légende avec ITEMFONTBOLD=TRUE

ITEMFONTSIZE

This parameter specifies the font size for rendering layer title in point.

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=airports,places
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&ITEMFONTSIZE=20
../../../_images/wms_getlegendgraphic_itemfontsize.png

Fig. 3.18 Légende avec ITEMFONTSIZE=30

ITEMFONTITALIC

This parameter specifies whether the item label is rendered in italic. Available values are (not case sensitive):

  • TRUE

  • FALSE

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=airports,places
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&ITEMFONTITALIC=TRUE
../../../_images/wms_getlegendgraphic_itemfontitalic.png

Fig. 3.19 Légende avec ITEMFONTITALIC=TRUE

ITEMFONTCOLOR

This parameter specifies the item label color. The color may be literal (red, green, ..) or in hexadecimal notation (0xFF0000, 0x00FF00, …).

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetLegendGraphic
&LAYERS=airports,places
&BBOX=43.20,-2.93,49.35,8.32
&CRS=EPSG:4326
&TRANSPARENT=TRUE
&ITEMFONTCOLOR=0x5f9930
../../../_images/wms_getlegendgraphic_itemfontcolor.png

Fig. 3.20 Légende avec ITEMFONTCOLOR=0x5f9930

ADDLAYERGROUPS

This parameter specifies if the JSON output will also display the names of the layers groups (and subgroups) in the legend entry. Possible values are:

  • TRUE: display the groups labels

  • FALSE (default): hide the groups labels

../../../_images/wms_getlegendgraphic_addlayergroups.png

Fig. 3.21 Legend without (left) and with (right) layer groups labels display

The corresponding JSON output showing groups name would look like:

{ "nodes":
  [{ "nodes":
     [{ "icon":"iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAUklEQVQ4jWNgGAXDHzASUqCsrPwfmX/37l28evBKKisr/0+a7IMiNi93C15DcUpgM4wYQ5nwuZAcMIQNvHv3LuO83C0kG0hysoFZRrJNo2AYAQC87BpkGQj1fwAAAABJRU5ErkJggg==",
        "title":"layer_a", "type":"layer"
     },
     { "nodes":
       [{ "icon":"iVBORw0KGgoAAAANSUhEUgAAABMAAAAUCAYAAABvVQZ0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAHUlEQVQ4jWNgGAWjYCQDxh887r8G2hGjYBQMGAAA1x0CR0FzIkYAAAAASUVORK5CYII=",
          "title":"layer_b", "type":"layer"
        },
        { "icon":"iVBORw0KGgoAAAANSUhEUgAAABMAAAAUCAYAAABvVQZ0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAHUlEQVQ4jWNgGAWjYCQDxtmzZ/8aaEeMglEwYAAAaIoCzTtn5XoAAAAASUVORK5CYII=",
          "title":"layer_c", "type":"layer"
       }],
       "title":"lines", "type":"group"
     },
     { "icon":"iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAKklEQVQ4jWNUVlX/z0AlwMLAwMDAnXmQKoYxUcWUUcNGDRs1bNSwYWYYACXDAsvQaTuVAAAAAElFTkSuQmCC",
       "title":"layer_d", "type":"layer"
     }],
     "title":"top-level-group", "type":"group"
  }],
  "title":""
}

3.2.5. GetStyle(s)

Standard parameters for the GetStyle (or GetStyles) request according to the OGC WMS 1.1.1 specifications:

Paramètre

Requis

Description

SERVICE

Oui

Nom du service (WMS)

REQUEST

Oui

Nom de la requête (GetStyle ou GetStyles)

LAYERS

Oui

Couches à interroger

The GetStyle request supports as well the following vendor parameters:

Paramètre

Requis

Description

MAP

Oui

Fichier du projet QGIS

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetStyles
&LAYERS=mylayer1,mylayer2

3.2.6. DescribeLayer

Standard parameters for the DescribeLayer request according to the OGC WMS 1.1.1 and 1.3.0 specifications:

Paramètre

Requis

Description

SERVICE

Oui

Nom du service (WMS)

REQUEST

Oui

Nom de la requête (DescribeLayer)

LAYERS

Oui

Couches à décrire

SLD_VERSION

Oui

Version de SLD

The DescribeLayer request supports as well the following vendor parameters:

Paramètre

Requis

Description

MAP

Oui

Fichier du projet QGIS

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=DescribeLayer
&SLD_VERSION=1.1.0
&LAYERS=mylayer1

Le document XML ressemble à :

<DescribeLayerResponse xmlns="http://www.opengis.net/sld" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ows="http://www.opengis.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:se="http://www.opengis.net/se" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/DescribeLayer.xsd">
    <Version>1.1.0</Version>
    <LayerDescription>
        <owsType>wfs</owsType>
        <se:OnlineResource xlink:href="http://localhost/qgisserver" xlink:type="simple"/>
        <TypeName>
            <se:FeatureTypeName>my_vector_layer</se:FeatureTypeName>
        </TypeName>
    </LayerDescription>
    <LayerDescription>
        <owsType>wcs</owsType>
        <se:OnlineResource xlink:href="http://localhost/qgisserver" xlink:type="simple"/>
        <TypeName>
            <se:FeatureTypeName>my_raster_layer</se:FeatureTypeName>
        </TypeName>
    </LayerDescription>
</DescribeLayerResponse>

SLD_VERSION

This parameter allows to specify the version of SLD. Only the value 1.1.0 is available.

3.2.7. GetPrint

QGIS Server a la capacité de créer une sortie de mise en page d’impression au format pdf ou pixel. Les fenêtres de mise en page d’impression dans le projet publié sont utilisées comme modèles. Dans la demande GetPrint, le client a la possibilité de spécifier les paramètres des mises en page et des étiquettes contenues.

The GetPrint request supports redlining, external WMS layers as well as the following parameters:

Paramètre

Requis

Description

MAP

Oui

Fichier du projet QGIS

SERVICE

Oui

Nom du service (WMS)

REQUEST

Oui

Nom de la requête (GetPrint)

VERSION

Non

Version du service

LAYERS

Non

Couches à afficher

TEMPLATE

Oui

Modèle de mise en page à utiliser

SRS / CRS

Oui

Système de coordonnées de référence

FORMAT

Non

Format de sortie

FORMAT_OPTIONS

Non

Options du format de fichier spécifié

Only for FORMAT=application/pdf

ATLAS_PK

Non

Entité atlas

STYLES

Non

Style des couches

TRANSPARENT

Non

Arrière-plan transparent

OPACITIES

Non

Opacité pour une couche ou un groupe

SELECTION

Non

Mettre en évidence d’entités

mapX:EXTENT

Non

Étendue de la carte “X”

mapX:LAYERS

Non

Couches de la carte “X”

mapX:STYLES

Non

Style de couche de la carte “X”

mapX:SCALE

Non

Échelle des couches de la carte “X”

mapX:ROTATION

Non

Rotation de la carte “X”

mapX:GRID_INTERVAL_X

Non

Intervalle de grille sur l’axe x de la carte “X”

mapX:GRID_INTERVAL_Y

Non

Intervalle de grille sur l’axe y de la carte “X”

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetPrint
&MAP=/home/qgis/projects/world.qgs
&CRS=EPSG:4326
&FORMAT=png
&TEMPLATE=Layout%201
&map0:EXTENT=-180,-90,180,90
&map0:LAYERS=mylayer1,mylayer2,mylayer3
&map0:OPACITIES=125,200,125
&map0:ROTATION=45

Notez que le modèle de mise en page peut contenir plusieurs cartes. De cette façon, si vous souhaitez configurer une carte spécifique, vous devez utiliser les paramètres mapX:X est un nombre positif que vous pouvez récupérer grâce à la requête GetProjectSettings.

Par exemple:

<WMS_Capabilities>
...
<ComposerTemplates xsi:type="wms:_ExtendedCapabilities">
<ComposerTemplate width="297" height="210" name="Druckzusammenstellung 1">
<ComposerMap width="171" height="133" name="map0"/>
<ComposerMap width="49" height="46" name="map1"/></ComposerTemplate>
</ComposerTemplates>
...
</WMS_Capabilities>

TEMPLATE

Ce paramètre peut être utilisé pour spécifier le nom d’un modèle de mise en page à utiliser pour l’impression.

FORMAT

Ce paramètre spécifie le format de l’image de la carte. Les valeurs disponibles sont:

  • png (valeur par défaut)

  • image/png

  • jpg

  • jpeg

  • image/jpeg

  • svg

  • image/svg

  • image/svg+xml

  • pdf

  • application/pdf

Si le paramètre FORMAT est différent de l’une de ces valeurs, une exception est renvoyée.

FORMAT_OPTIONS

This parameter can be used to specify options for the selected format. Only for FORMAT=application/pdf in GetPrint requests. Takes a list of key:value pairs separated by semicolon:

  • RASTERIZE_WHOLE_IMAGE: whether the whole pdf should be exported as an image. Default: false.

  • FORCE_VECTOR_OUTPUT: whether pdf should be exported as vector. Default: false.

  • APPEND_GEOREFERENCE: whether georeference info shall be added to the pdf. Default: true.

  • EXPORT_METADATA: whether metadata shall be added to the pdf. Default: true.

  • TEXT_RENDER_FORMAT: sets the text render format for pdf export. It can be AlwaysOutlines (default) or AlwaysText.

  • SIMPLIFY_GEOMETRY: whether features geometries shall be simplified. Default: true.

  • WRITE_GEO_PDF: whether a GeoPDF shall be exported. Default: false.

  • USE_ISO_32000_EXTENSION_FORMAT_GEOREFERENCING: whether Iso32000 georeferencing shall be used. Default: false.

  • USE_OGC_BEST_PRACTICE_FORMAT_GEOREFERENCING: whether OGC best practice georeferencing shall be used. Default: false.

  • EXPORT_THEMES: a comma separated list of map themes to use for a GeoPDF export

  • PREDEFINED_MAP_SCALES: a comma separated list of map scales to render the map

  • LOSSLESS_IMAGE_COMPRESSION: whether images embedded in pdf must be compressed using a lossless algorithm. Default: false.

  • DISABLE_TILED_RASTER_RENDERING: whether rasters shall be untiled in the pdf. Default: false.

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetPrint
&MAP=/home/qgis/projects/world.qgs
&CRS=EPSG:4326
&FORMAT=pdf
&TEMPLATE=Layout%201
&FORMAT_OPTIONS=FORCE_VECTOR_OUTPUT:TRUE;TEXT_RENDER_FORMAT:AlwaysOutlines;PREDEFINED_MAP_SCALES:250

ATLAS_PK

Ce paramètre permet d’activer le rendu Atlas en indiquant quelles entités nous voulons imprimer. Afin de récupérer un atlas avec toutes les fonctionnalités, le symbole * peut être utilisé (selon le nombre maximum d entités autorisé dans la configuration du projet).

Lorsque FORMAT est pdf, un seul document PDF combinant les pages d’entités est renvoyé. Pour tous les autres formats, une seule page est renvoyée.

mapX:EXTENT

Ce paramètre spécifie l’étendue d’un élément de mise en page sous la forme xmin, ymin, xmax, ymax.

mapX:ROTATION

Ce paramètre spécifie la rotation de la carte en degrés.

mapX:GRID_INTERVAL_X

Ce paramètre spécifie la densité du quadrillage dans la direction X.

mapX:GRID_INTERVAL_Y

Ce paramètre spécifie la densité de la ligne de grille dans la direction Y.

mapX:SCALE

Ce paramètre spécifie l’échelle de la carte pour un élément de la mise en page. Ceci est utile pour assurer une visibilité basée sur l’échelle des couches et des étiquettes même si le client et le serveur peuvent avoir des algorithmes différents pour calculer le dénominateur d’échelle.

mapX:LAYERS

This parameter specifies the layers for a layout map item. See GetMap Layers for more information on this parameter.

mapX:STYLES

This parameter specifies the layers” styles defined in a specific layout map item. See GetMap Styles for more information on this parameter.

3.2.8. GetProjectSettings

This request type works similar to GetCapabilities, but it is more specific to QGIS Server and allows a client to read additional information which are not available in the GetCapabilities output:

  • visibilité initiale des couches

  • information sur les attributs des vecteurs et leur type d’éditeur

  • information sur l’ordre des couches et de leur rendu

  • liste des couches publiées en WFS

  • montrer si un groupe dans l’arbre des couches est mutualy exclusive

The GetProjectSettings request supports the following parameters:

Paramètre

Requis

Description

MAP

Oui

Fichier du projet QGIS

SERVICE

Oui

Nom du service (WMS)

REQUEST

Oui

Nom de la requête (GetProjectSettings)

3.2.9. GetSchemaExtension

The GetSchemaExtension request allows to retrieve optional extended capabilities and operations of the WMS service such as implemented by QGIS Server.

Paramètre

Requis

Description

MAP

Oui

Fichier du projet QGIS

SERVICE

Oui

Nom du service (WMS)

REQUEST

Oui

Nom de la requête (GetSchemaExtension)

Exemple d’URL :

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetSchemaExtension

Le document XML ressemble à :

<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:wms="http://www.opengis.net/wms" xmlns:qgs="http://www.qgis.org/wms" targetNamespace="http://www.qgis.org/wms" elementFormDefault="qualified" version="1.0.0">
    <import namespace="http://www.opengis.net/wms" schemaLocation="http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd"/>
    <element name="GetPrint" type="wms:OperationType" substitutionGroup="wms:_ExtendedOperation"/>
    <element name="GetStyles" type="wms:OperationType" substitutionGroup="wms:_ExtendedOperation"/>
</schema>

3.2.10. Couches WMS externes

QGIS Server allows including layers from external WMS servers in WMS GetMap and WMS GetPrint requests. This is especially useful if a web client uses an external background layer in the web map. For performance reasons, such layers should be directly requested by the web client (not cascaded via QGIS server). For printing however, these layers should be cascaded via QGIS server in order to appear in the printed map.

External layers can be added to the LAYERS parameter as EXTERNAL_WMS:<layername>. The parameters for the external WMS layers (e.g. url, format, dpiMode, crs, layers, styles) can later be given as service parameters <layername>:<parameter>. In a GetMap request, this might look like this:

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetMap
&LAYERS=EXTERNAL_WMS:basemap,layer1,layer2
&OPACITIES=100,200,255
&STYLES=,,
&basemap:url=http://externalserver.com/wms.fcgi
&basemap:format=image/jpeg
&basemap:dpiMode=7
&basemap:crs=EPSG:2056
&basemap:layers=orthofoto
&basemap:styles=default

Similarly, external layers can be used in GetPrint requests:

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetPrint
&TEMPLATE=A4
&map0:layers=EXTERNAL_WMS:basemap,layer1,layer2
&map0:EXTENT=<minx,miny,maxx,maxy>
&OPACITIES=100,200,255
&basemap:url=http://externalserver.com/wms.fcgi
&basemap:format=image/jpeg
&basemap:dpiMode=7
&basemap:crs=EPSG:2056
&basemap:layers=orthofoto
&basemap:styles=default

3.2.11. Redlining

This feature is available and can be used with GetMap and GetPrint requests.

La fonction de mise en évidence peut être utilisée pour transmettre des géométries et des étiquettes dans la demande qui se chevauchent par le serveur sur l’image retournée standard (carte). Cela permet à l’utilisateur de mettre l’accent ou peut-être d’ajouter des commentaires (étiquettes) à certaines zones, emplacements, etc. qui ne figurent pas sur la carte standard.

The GetMap request is in the format:

http://localhost/qgisserver?
SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetMap
&HIGHLIGHT_GEOM=POLYGON((590000 5647000, 590000 6110620, 2500000 6110620, 2500000 5647000, 590000 5647000))
&HIGHLIGHT_SYMBOL=<StyledLayerDescriptor><UserStyle><Name>Highlight</Name><FeatureTypeStyle><Rule><Name>Symbol</Name><LineSymbolizer><Stroke><SvgParameter name="stroke">%23ea1173</SvgParameter><SvgParameter name="stroke-opacity">1</SvgParameter><SvgParameter name="stroke-width">1.6</SvgParameter></Stroke></LineSymbolizer></Rule></FeatureTypeStyle></UserStyle></StyledLayerDescriptor>
&HIGHLIGHT_LABELSTRING=Write label here
&HIGHLIGHT_LABELSIZE=16
&HIGHLIGHT_LABELCOLOR=%23000000
&HIGHLIGHT_LABELBUFFERCOLOR=%23FFFFFF
&HIGHLIGHT_LABELBUFFERSIZE=1.5

The GetPrint equivalent is in the format (note that mapX: parameter is added to tell which map has redlining):

http://localhost/qgisserver?
SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetPrint
&map0:HIGHLIGHT_GEOM=POLYGON((590000 5647000, 590000 6110620, 2500000 6110620, 2500000 5647000, 590000 5647000))
&map0:HIGHLIGHT_SYMBOL=<StyledLayerDescriptor><UserStyle><Name>Highlight</Name><FeatureTypeStyle><Rule><Name>Symbol</Name><LineSymbolizer><Stroke><SvgParameter name="stroke">%23ea1173</SvgParameter><SvgParameter name="stroke-opacity">1</SvgParameter><SvgParameter name="stroke-width">1.6</SvgParameter></Stroke></LineSymbolizer></Rule></FeatureTypeStyle></UserStyle></StyledLayerDescriptor>
&map0:HIGHLIGHT_LABELSTRING=Write label here
&map0:HIGHLIGHT_LABELSIZE=16
&map0:HIGHLIGHT_LABELCOLOR=%23000000
&map0:HIGHLIGHT_LABELBUFFERCOLOR=%23FFFFFF
&map0:HIGHLIGHT_LABELBUFFERSIZE=1.5

Voici l’image produite par la demande ci-dessus dans laquelle un polygone et une étiquette sont dessinés au-dessus de la carte normale:

../../../_images/server_redlining.png

Fig. 3.22 Réponse du serveur à une demande GetMap avec paramètres de mise en évidence

You can see there are several parameters in this request to control the redlining feature. The full list includes:

  • HIGHLIGHT_GEOM: Vous pouvez ajouter POINT, MULTILINESTRING, POLYGON etc. Il prend en charge les géométries en plusieurs parties. Voici un exemple: HIGHLIGHT_GEOM = MULTILINESTRING((0 0, 0 1, 1 1)). Les coordonnées doivent être dans le CRS de la demande GetMap / GetPrint.

  • HIGHLIGHT_LABELBUFFERCOLOR: ce paramètre contrôle la couleur du tampon d’étiquette.

  • HIGHLIGHT_LABELBUFFERSIZE: ce paramètre contrôle la taille du tampon d’étiquette.

  • HIGHLIGHT_LABELCOLOR: ce paramètre contrôle la couleur de l’étiquette.

  • HIGHLIGHT_LABEL_DISTANCE: controls the distance between feature (e.g. point or line) and the label in mm

  • HIGHLIGHT_LABELFONT : Ce paramètre contrôle la police de l’étiquette (par exemple Arial)

  • HIGHLIGHT_LABEL_HORIZONTAL_ALIGNMENT: places the label horizontally on a point using the specified alignment (e.g. “left”, “center”, “right”)

  • HIGHLIGHT_LABEL_ROTATION: controls the label rotation in degrees

  • HIGHLIGHT_LABELSIZE: ce paramètre contrôle la taille de l’étiquette.

  • HIGHLIGHT_LABELSTRING: vous pouvez transmettre votre texte d’étiquetage à ce paramètre.

  • HIGHLIGHT_LABEL_VERTICAL_ALIGNMENT: places the label vertically on a point using the specified alignment (e.g. “top”, “half”, “bottom”)

  • HIGHLIGHT_SYMBOL: cela contrôle la manière dont la géométrie est définie et vous pouvez modifier la largeur, la couleur et l’opacité du trait.