18.2.2. サービス

QGISサーバーでは、 Open Geospatial Consortium(OGC) に記載されているように、標準プロトコルに従ってデータを提供できます。

  • WMS 1.1.0 and 1.3.0

  • WFS 1.0.0 and 1.1.0

  • WFS3 (OGC API - Features)

  • WCS 1.1.1

  • WMTS 1.0.0

QGISレンダリングエンジンのおかげでその振る舞いをカスタマイズする可能性を大いに高めるオリジナルの規格に加えて、追加のベンダーパラメータと要求がサポートされています。

18.2.2.1. Web地図サービス (WMS)

QGISサーバーに実装された 1.1.0 および 1.3.0 WMS標準は、QGISプロジェクトから作成された地図または凡例の画像を要求するHTTPインターフェースを提供します。典型的なWMSリクエストは、使用するQGISプロジェクト、レンダリングするレイヤ、作成する画像フォーマットを定義します。 Styled Layer Descriptor(SLD) 規格についても基本的なサポートが利用可能です。

Specifications document according to the version number of the service:

Standard requests provided by QGIS Server:

Request

説明

GetCapabilities

Returns XML metadata with information about the server

GetMap

Returns a map

GetFeatureInfo

Retrieves data (geometry and values) for a pixel location

GetLegendGraphics

Returns legend symbols

Vendor requests provided by QGIS Server:

Request

説明

GetPrint

Returns a QGIS composition

GetProjectSettings

Returns specific information about QGIS Server

18.2.2.1.1. GetMap

Standard parameters for the GetMap request according to the OGC WMS 1.1.0 and 1.3.0 specifications:

パラメーター

必須

説明

SERVICE

はい

Name of the service (WMS)

VERSION

いいえ

Version of the service

REQUEST

はい

Name of the request (GetMap)

LAYERS

いいえ

Layers to display

STYLES

いいえ

Layers' style

SRS / CRS

はい

座標参照系

BBOX

いいえ

Map extent

WIDTH

はい

Width of the image in pixels

HEIGHT

はい

Height of the image in pixels

FORMAT

いいえ

Image format

TRANSPARENT

いいえ

透明な背景

標準のものに加えて、QGISサーバーでは以下の追加パラメータをサポートしています:

パラメーター

必須

説明

MAP

はい

Specify the QGIS project file

BGCOLOR

いいえ

Specify the background color

DPI

いいえ

Specify the output resolution

IMAGE_QUALITY

いいえ

JPEG compression

OPACITIES

いいえ

Opacity for layer or group

FILTER

いいえ

Subset of features

SELECTION

いいえ

Highlight features

FILE_NAME

いいえ

Only for FORMAT=application/dxf

File name of the downloaded file

FORMAT_OPTIONS

いいえ

Only for FORMAT=application/dxf key:value pairs separated by semicolon.

  • SCALE: to be used for symbology rules, filters and styles (not actual scaling of the data - data remains in the original scale).

  • MODE: corresponds to the export options offered in the QGIS Desktop DXF export dialog. Possible values are NOSYMBOLOGY, FEATURESYMBOLOGY and SYMBOLLAYERSYMBOLOGY.

  • LAYERSATTRIBUTES: specify a field that contains values for DXF layer names - if not specified, the original QGIS layer names are used.

  • USE_TITLE_AS_LAYERNAME: if enabled, the title of the layer will be used as layer name.

  • CODEC: specify a codec to be used for encoding. Default is ISO-8859-1 check the QGIS desktop DXF export dialog for valid values.

TILED

いいえ

Working in tiled mode

URL example:

http://localhost/qgis_server?
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

18.2.2.1.1.1. SERVICE

This parameter has to be WMS in case of the GetMap request.

18.2.2.1.1.2. VERSION

This parameter allows to specify the version of the service to use. Available values for the VERSION parameter are:

  • 1.1.0

  • 1.3.0

If no version is indicated in the request, then 1.3.0 is used by default.

According to the version number, slight differences have to be expected as explained later for the next parameters:

  • CRS / SRS

  • BBOX

18.2.2.1.1.3. REQUEST

This parameter is GetMap in case of the GetMap request.

18.2.2.1.1.4. LAYERS

This parameter allows to specify the layers to display on the map. Names have to be separated by a comma.

In addition, QGIS Server introduced some options to select layers by:

  • a short name

  • the layer id

The short name of a layer may be configured through Properties ‣ Metadata in layer menu. If the short name is defined, then it's used by default instead of the layer's name:

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetMap
&LAYERS=mynickname1,mynickname2
&...

さらに、プロジェクト - > プロパティ ... ダイアログの OWSサーバ - > WMS capabilities メニューにIDでレイヤーを選択できるプロジェクトオプションがあります。このオプションを有効にするには、チェックボックス レイヤーIDを名前として使用 を選択する必要があります。

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

18.2.2.1.1.5. STYLES

This parameter can be used to specify a layer's style for the rendering step. Styles have to be separated by a comma. The name of the default style is default.

18.2.2.1.1.6. SRS / CRS

This parameter allows to indicate the map output Spatial Reference System in WMS 1.1.0 and has to be formed like EPSG:XXXX. Note that CRS is also supported if current version is 1.1.0.

For WMS 1.3.0, CRS parameter is preferable but SRS is also supported.

Note that if both CRS and SRS parameters are indicated in the request, then it's the current version indicated in VERSION parameter which is decisive.

In the next case, the SRS parameter is kept whatever the VERSION parameter because CRS is not indicated:

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

In the next case, the SRS parameter is kept instead of CRS because of the VERSION parameter:

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

In the next case, the CRS parameter is kept instead of SRS because of the VERSION parameter:

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

18.2.2.1.1.7. BBOX

This parameter allows to specify the map extent with units according to the current CRS. Coordinates have to be separated by a comma.

However, a slight difference has to be noticed according to the current VERSION parameter. In WMS 1.1.0, coordinates are formed like minx,miny,maxx,maxy or minlong,minlat,maxlong,maxlat. For example:

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

But the axis is reversed in WMS 1.3.0, so coordinates are formed like: miny,minx,maxy,maxx or minlat,minlong,maxlat,maxlong. For example:

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

18.2.2.1.1.8. WIDTH

This parameter allows to specify the width in pixels of the output image.

18.2.2.1.1.9. HEIGHT

This parameter allows to specify the height in pixels of the output image.

18.2.2.1.1.10. FORMAT

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

  • jpg

  • jpeg

  • image/jpeg

  • image/png

  • image/png; mode=1bit

  • image/png; mode=8bit

  • image/png; mode=16bit

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

    URL example:

    http://localhost/qgisserver?
    SERVICE=WMS&VERSION=1.3.0
    &REQUEST=GetMap
    &FORMAT=application/dxf
    &LAYERS=Haltungen,Normschacht,Spezialbauwerke
    &STYLES=
    &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
    

18.2.2.1.1.11. TRANSPARENT

This boolean parameter can be used to specify the background transparency. Available values are (not case sensitive):

  • TRUE

  • FALSE

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

18.2.2.1.1.12. MAP

This parameter allows to define the QGIS project file to use.

GetMap パラメータテーブル で述べたように、リクエストは実際に動作するためにQGISプロジェクトを必要とするので MAP は必須です。しかし、 QGIS_PROJECT_FILE 環境変数がデフォルトのQGISプロジェクトを定義するために使用されるかもしれません。この場合、 MAP はもはや必須のパラメータではありません。より詳しい情報は 高度な構成 を参照してください。

18.2.2.1.1.13. BGCOLOR

This parameter allows to indicate a background color for the map image. However it cannot be combined with TRANSPARENT parameter in case of PNG images (transparency takes priority). The colour may be literal or in hexadecimal notation.

URL example with the literal notation:

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

URL example with the hexadecimal notation:

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

18.2.2.1.1.14. DPI

This parameter can be used to specify the requested output resolution.

18.2.2.1.1.15. IMAGE_QUALITY

This parameter is only used for JPEG images. By default, the JPEG compression is -1.

You can change the default per QGIS project in the OWS Server ‣ WMS capabilities menu of the Project ‣ Properties... dialog. If you want to override it in a GetMap request you can do it using the IMAGE_QUALITY parameter.

18.2.2.1.1.16. OPACITIES

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

18.2.2.1.1.17. FILTER

A subset of layers can be selected with the FILTER parameter. The syntax is basically the same as for the QGIS subset string. However, there are some restrictions to avoid SQL injections into databases via QGIS Server. If a dangerous string is found in the parameter, QGIS Server will return the next error:

Indeed, text strings need to be enclosed with quotes (single quotes
for strings, double quotes for attributes). A space between each
word / special character is mandatory. Allowed Keywords and special
characters are 'AND','OR','IN','=','<','>=','>','>=','!=*,'(',')'.
Semicolons in string expressions are not allowed.

URL example:

http://localhost/qgisserver?
SERVICE=WMS
&REQUEST=GetMap
&LAYERS=mylayer1,mylayer2,mylayer3
&FILTER=mylayer1:"col1";mylayer1,mylayer2:"col2" = 'blabla'
&...

In this example, the same filter (field col2 equals the string blabla) is applied to layers mylayer1 and mylayer2, while the filter on col1 is only applied to mylayer1.

注釈

It is possible to make attribute searches via GetFeatureInfo and omit the X/Y parameter if a FILTER is there. QGIS Server then returns info about the matching features and generates a combined bounding box in the XML output.

18.2.2.1.1.18. SELECTION

The SELECTION parameter can highlight features from one or more layers. Vector features can be selected by passing comma separated lists with feature ids.

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

The following image presents the response from a GetMap request using the SELECTION option e.g. http://myserver.com/...&SELECTION=countries:171,65.

As those features id's correspond in the source dataset to France and Romania they're highlighted in yellow.

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

図 18.8 SELECTIONパラメーターを指定したGetMapリクエストに対するサーバーの応答

18.2.2.1.1.19. TILED

Set the TILED parameter to TRUE to tell QGIS Server to work in tiled mode, and to apply the Tile buffer configured in the QGIS project.

When TILED is TRUE and when a non-zero Tile buffer is configured in the QGIS project, features outside the tile extent are drawn to avoid cut symbols at tile boundaries.

TILED defaults to FALSE.

18.2.2.1.2. GetFeatureInfo

Standard parameters for the GetFeatureInfo request according to the OGC WMS 1.1.0 and 1.3.0 specifications:

パラメーター

必須

説明

SERVICE

はい

Name of the service (WMS)

VERSION

いいえ

See GetMap

REQUEST

はい

See GetMap

LAYERS

いいえ

See GetMap

STYLES

いいえ

See GetMap

SRS / CRS

はい

See GetMap

BBOX

いいえ

See GetMap

WIDTH

はい

See GetMap

HEIGHT

はい

See GetMap

TRANSPARENT

いいえ

See GetMap

INFO_FORMAT

いいえ

出力形式

QUERY_LAYERS

はい

Layers to query

FEATURE_COUNT

いいえ

Maximum number of features to return

I

いいえ

Pixel column of the point to query

X

いいえ

Same as I parameter, but in WMS 1.1.0

J

いいえ

Pixel row of the point to query

Y

いいえ

Same as J parameter, but in WMS 1.1.0

標準のものに加えて、QGISサーバーでは以下の追加パラメータをサポートしています:

パラメーター

必須

説明

MAP

はい

See GetMap

FILTER

いいえ

See GetMap

FI_POINT_TOLERANCE

いいえ

Tolerance in pixels for point layers

FI_LINE_TOLERANCE

いいえ

ラインレイヤでの許容誤差(ピクセル)

FI_POLYGON_TOLERANCE:

いいえ

Tolerance in pixels for polygon layers

FILTER_GEOM

いいえ

Geometry filtering

WITH_MAPTIP

いいえ

Add map tips to the output

WITH_GEOMETRY

いいえ

Add geometry to the output

URL example:

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

18.2.2.1.2.1. INFO_FORMAT

このパラメータは結果のフォーマットを指定するために使用されます。利用可能な値は以下のとおりです:

  • text/xml

  • text/html

  • text/plain

  • application/vnd.ogc.gml

  • application/json

18.2.2.1.2.2. QUERY_LAYERS

This parameter specifies the layers to display on the map. Names are separated by a comma.

In addition, QGIS Server introduces options to select layers by:

  • short name

  • layer id

See the LAYERS parameter defined in See GetMap for more information.

18.2.2.1.2.3. FEATURE_COUNT

このパラメータでは、レイヤごとに返す地物の最大数を指定します。例えば、 QUERY_LAYERSlayer1,layer2 に設定され、 FEATURE_COUNT3 に設定されている場合、layer1から最大3つの地物が返されます。同様に、layer2から最大3つの地物が返されます。

By default, only 1 feature per layer is returned.

18.2.2.1.2.4. I

This parameter, defined in WMS 1.3.0, allows you to specify the pixel column of the query point.

18.2.2.1.2.5. X

Same parameter as I, but defined in WMS 1.1.0.

18.2.2.1.2.6. J

This parameter, defined in WMS 1.3.0, allows you to specify the pixel row of the query point.

18.2.2.1.2.7. Y

Same parameter as J, but defined in WMS 1.1.0.

18.2.2.1.2.8. FI_POINT_TOLERANCE

このパラメータではラインレイヤでの許容誤差(ピクセル)を指定します。

18.2.2.1.2.9. FI_LINE_TOLERANCE

This parameter specifies the tolerance in pixels for line layers.

18.2.2.1.2.10. FI_POLYGON_TOLERANCE:

This parameter specifies the tolerance in pixels for polygon layers.

18.2.2.1.2.11. FILTER_GEOM

This parameter specifies a WKT geometry with which features have to intersect.

18.2.2.1.2.12. WITH_MAPTIP

This parameter specifies whether to add map tips to the output.

Available values are (not case sensitive):

  • TRUE

  • FALSE

18.2.2.1.2.13. WITH_GEOMETRY

This parameter specifies whether to add geometries to the output.

Available values are (not case sensitive):

  • TRUE

  • FALSE

18.2.2.1.3. GetPrint

QGISサーバには、PDFまたはピクセル形式のプリントレイアウト出力を作成する機能があります。公表されたプロジェクトでのプリントレイアウトがテンプレートとして使用されます。GETPRINT要求では、クライアントは含まれているレイアウト地図とラベルのパラメータを指定する可能性があります。

Parameters for the GetPrint request:

パラメーター

必須

説明

MAP

はい

Specify the QGIS project file

SERVICE

はい

Name of the service (WMS)

VERSION

いいえ

See GetMap

REQUEST

はい

Name of the request (GetPrint)

LAYERS

いいえ

See GetMap

TEMPLATE

はい

Layout template to use

SRS / CRS

はい

See GetMap

FORMAT

はい

出力形式

ATLAS_PK

いいえ

Atlas features

STYLES

いいえ

See GetMap

TRANSPARENT

いいえ

See GetMap

OPACITIES

いいえ

See GetMap

SELECTION

いいえ

See GetMap

mapX:EXTENT

いいえ

Extent of the map 'X'

mapX:LAYERS

いいえ

Layers of the map 'X'

mapX:STYLES

いいえ

Layers' style of the map 'X'

mapX:SCALE

いいえ

Layers' scale of the map 'X'

mapX:ROTATION

いいえ

Rotation of the map 'X'

mapX:GRID_INTERVAL_X

いいえ

Grid interval on x axis of the map 'X'

mapX:GRID_INTERVAL_Y

いいえ

Grid interval on y axis of the map 'X'

URL example:

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

レイアウトテンプレートには複数のマップが含まれている可能性があることに注意してください。このように、特定のマップを設定したい場合は、 mapX: パラメータを使う必要があります。ここで、 XGetProjectSettings リクエストのおかげで取得できる正数です。

For example:

<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>

18.2.2.1.3.1. SERVICE

This parameter has to be WMS.

18.2.2.1.3.2. REQUEST

This parameter has to be GetPrint for the GetPrint request.

18.2.2.1.3.3. TEMPLATE

This parameter can be used to specify the name of a layout template to use for printing.

18.2.2.1.3.4. FORMAT

This parameter specifies the format of map image. Available values are:

  • jpg

  • jpeg

  • image/jpeg

  • png

  • image/png

  • svg

  • image/svg

  • image/svg+xml

  • pdf

  • application/pdf

If the FORMAT parameter is different from one of these values, then an exception is returned.

18.2.2.1.3.5. ATLAS_PK

This parameter allows activation of Atlas rendering by indicating which features we want to print. In order to retrieve an atlas with all features, the * symbol may be used (according to the maximum number of features allowed in the project configuration).

When FORMAT is pdf, a single PDF document combining the feature pages is returned. For all other formats, a single page is returned.

18.2.2.1.3.6. mapX:EXTENT

This parameter specifies the extent for a layout map item as xmin,ymin,xmax,ymax.

18.2.2.1.3.7. mapX:ROTATION

This parameter specifies the map rotation in degrees.

18.2.2.1.3.8. mapX:GRID_INTERVAL_X

This parameter specifies the grid line density in the X direction.

18.2.2.1.3.9. mapX:GRID_INTERVAL_Y

This parameter specifies the grid line density in the Y direction.

18.2.2.1.3.10. mapX:SCALE

このパラメータは、レイアウト地図アイテムの地図縮尺を指定します。これは、クライアントとサーバーで縮尺分母を計算するアルゴリズムが異なる場合でもレイヤとラベルの縮尺に基づく可視性を確保するのに役立ちます。

18.2.2.1.3.11. mapX:LAYERS

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

18.2.2.1.3.12. mapX:STYLES

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

18.2.2.1.4. GetLegendGraphics

いくつかの追加のパラメーターは、凡例の要素のサイズを変更できます:

  • BOXSPACE 凡例フレームと内容の間の空白(mm)

  • LAYERSPACE vertical space between layers (mm)

  • LAYERTITLESPACE レイヤータイトルと後続アイテム間の垂直方向のスペース(mm)

  • SYMBOLSPACE シンボルとアイテム間の垂直方向の間隔(mm)

  • ICONLABELSPACE シンボルとラベルのテキストの間の水平スペース(ミリメートル)

  • SYMBOLWIDTH シンボルプレビューの幅(mm)

  • SYMBOLHEIGHT シンボルプレビューの高さ(mm)

これらのパラメーターは、レイヤーのタイトルや項目ラベルのフォントプロパティを変更します。

  • LAYERFONTFAMILY / ITEMFONTFAMILY レイヤータイトル/項目テキストのためのフォントファミリー

  • LAYERFONTBOLD / ITEMFONTBOLD TRUE to use a bold font

  • LAYERFONTSIZE / ITEMFONTSIZE ポイントでのフォントサイズ

  • LAYERFONTITALIC / ITEMFONTITALIC TRUE to use italic font

  • LAYERFONTCOLOR / ITEMFONTCOLOR Hex color code (e.g. #FF0000 for red)

  • LAYERTITLE FALSE to get only the legend graphics without the layer title

  • RULELABEL:

    • FALSE legend graphics without item labels

    • AUTO hide item label for layers with Single symbol rendering

コンテストに基づく凡例。これらのパラメータでは、要求された領域に入る地物のシンボルだけを表示する凡例をクライアントに要求させます。

  • BBOX 凡例を構築する必要のある地域

  • CRS / SRS BBOX座標を定義するために採用された座標参照系

  • 設定されている場合** WIDTH / HEIGHT **これらは、地図ビューの画像サイズに応じてQGIS サーバーがシンボルを縮尺設定できるように、GetMapリクエストのために定義されたものと一致する必要があります。

Content based legend features are based on the UMN MapServer implementation:

  • SHOWFEATURECOUNT if set to TRUE adds in the legend the feature count of the features like in the following image:

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

18.2.2.1.5. GetProjectSettings

このリクエストタイプは GetCapabilities に似ていますが、それはQGIS サーバーに対してより具体的であり、クライアントは、GetCapabilities出力では利用できない追加情報を読み取ることができます:

  • レイヤーの初期可視性

  • ベクターの属性とその編集タイプに関する情報

  • レイヤーの順序と描画順序に関する情報

  • WFSに掲載されたレイヤのリスト

18.2.2.2. Web Feature Service (WFS)

The 1.0.0 and 1.1.0 WFS standards implemented in QGIS Server provide a HTTP interface to query geographic features from a QGIS project. A typical WFS request defines the QGIS project to use and the layer to query.

Specifications document according to the version number of the service:

Standard requests provided by QGIS Server:

Request

説明

GetCapabilities

Returns XML metadata with information about the server

GetFeature

Returns a selection of features

DescribeFeatureType

Returns a description of feature types and properties

Transaction

Allows features to be inserted, updated or deleted

18.2.2.2.1. GetFeature

Standard parameters for the GetFeature request according to the OGC WFS 1.0.0 and 1.1.0 specifications:

パラメーター

必須

説明

SERVICE

はい

Name of the service

VERSION

いいえ

Version of the service

REQUEST

はい

Name of the request

TYPENAME

いいえ

レイヤの名前

OUTPUTFORMAT

いいえ

Output Format

RESULTTYPE

いいえ

Type of the result

PROPERTYNAME

いいえ

Name of properties to return

MAXFEATURES

いいえ

Maximum number of features to return

SRSNAME

いいえ

座標参照系

FEATUREID

いいえ

Filter the features by ids

FILTER

いいえ

OGC Filter Encoding

BBOX

いいえ

Map Extent

SORTBY

いいえ

Sort the results

標準のものに加えて、QGISサーバーでは以下の追加パラメータをサポートしています:

パラメーター

必須

説明

MAP

はい

Specify the QGIS project file

STARTINDEX

いいえ

Paging

GEOMETRYNAME

いいえ

Type of geometry to return

EXP_FILTER

いいえ

Expression filtering

18.2.2.2.1.1. SERVICE

This parameter has to be WFS in case of the GetFeature request.

For example:

http://localhost/qgisserver?
SERVICE=WFS
&...

18.2.2.2.1.2. VERSION

This parameter allows to specify the version of the service to use. Available values for the VERSION parameter are:

  • 1.0.0

  • 1.1.0

If no version is indicated in the request, then 1.1.0 is used by default.

URL example:

http://localhost/qgisserver?
SERVICE=WFS
&VERSION=1.1.0
&...

18.2.2.2.1.3. REQUEST

This parameter is GetFeature in case of the GetFeature request.

URL example:

http://localhost/qgisserver?
SERVICE=WFS
&VERSION=1.1.0
&REQUEST=GetFeature
&...

18.2.2.2.1.4. RESULTTYPE

This parameter may be used to specify the kind of result to return. Available values are:

  • results: the default behavior

  • hits: returns only a feature count

URL example:

http://localhost/qgisserver?
SERVICE=WFS
&VERSION=1.1.0
&REQUEST=GetFeature
&RESULTTYPE=hits
&...

18.2.2.2.1.5. GEOMETRYNAME

このパラメータは、地物に返すジオメトリの種類を指定するために使用できます。利用可能な値は以下のとおりです:

  • 範囲

  • 重心

  • なし

URL example:

http://localhost/qgisserver?
SERVICE=WFS
&VERSION=1.1.0
&REQUEST=GetFeature
&GEOMETRYNAME=centroid
&...

18.2.2.2.1.6. STARTINDEX

This parameter is standard in WFS 2.0, but it's an extension for WFS 1.0.0. Actually, it can be used to skip some features in the result set and in combination with MAXFEATURES, it provides the ability to page through results.

URL example:

http://localhost/qgisserver?
SERVICE=WFS
&VERSION=1.1.0
&REQUEST=GetFeature
&STARTINDEX=2
&...

18.2.2.3. Web Map Tile Service (WMTS)

QGISサーバに実装された 1.0.0 WMTS標準は、QGISプロジェクトから作成されたタイル地図画像を要求するためのHTTPインターフェースを提供します。典型的なWMTSリクエストでは、使用するQGISプロジェクト、レンダリングするレイヤなどの一部のWMSパラメータ、およびタイルパラメータを定義しました。

Specifications document of the service:

Standard requests provided by QGIS Server:

Request

説明

GetCapabilities

Returns XML metadata with information about the server

GetTile

Returns a tile

GetFeatureInfo

Retrieves data (geometry and values) for a pixel location

18.2.2.3.1. GetCapabilities

Standard parameters for the GetCapabilities request according to the OGC WMTS 1.0.0 specifications:

パラメーター

必須

説明

SERVICE

はい

Name of the service (WMTS)

REQUEST

はい

Name of the request (GetCapabilities)

標準のものに加えて、QGISサーバーでは以下の追加パラメータをサポートしています:

パラメーター

必須

説明

MAP

はい

Specify the QGIS project file

URL example:

http://localhost/qgisserver?
SERVICE=WMTS
&REQUEST=GetCapabilities
&MAP=/home/qgis/projects/world.qgs

18.2.2.3.1.1. SERVICE

This parameter has to be WMTS in case of the GetCapabilities request.

18.2.2.3.1.2. REQUEST

This parameter is GetCapabilities in case of the GetCapabilities request.

18.2.2.3.1.3. MAP

This parameter allows to define the QGIS project file to use.

18.2.2.3.2. GetTile

Standard parameters for the GetTile request according to the OGC WMTS 1.0.0 specifications:

パラメーター

必須

説明

SERVICE

はい

Name of the service (WMTS)

REQUEST

はい

Name of the request (GetTile)

LAYER

はい

Layer identifier

FORMAT

はい

Output format of the tile

TILEMATRIXSET

はい

Name of the pyramid

TILEMATRIX

はい

Meshing

TILEROW

はい

Row coordinate in the mesh

TILECOL

はい

Column coordinate in the mesh

標準のものに加えて、QGISサーバーでは以下の追加パラメータをサポートしています:

パラメーター

必須

説明

MAP

はい

Specify the QGIS project file

URL example:

http://localhost/qgisserver?
SERVICE=WMTS
&REQUEST=GetTile
&MAP=/home/qgis/projects/world.qgs
&LAYER=mylayer
&FORMAT=image/png
&TILEMATRIXSET=EPSG:4326
&TILEROW=0
&TILECOL=0

18.2.2.3.2.1. SERVICE

This parameter has to be WMTS in case of the GetTile request.

18.2.2.3.2.2. REQUEST

This parameter is GetTile in case of the GetTile request.

18.2.2.3.2.3. LAYER

This parameter allows to specify the layer to display on the tile.

In addition, QGIS Server introduced some options to select a layer by:

  • a short name

  • the layer id

The short name of a layer may be configured through Properties ‣ Metadata in layer menu. If the short name is defined, then it's used by default instead of the layer's name:

http://localhost/qgisserver?
SERVICE=WMTS
&REQUEST=GetTile
&LAYER=mynickname
&...

Moreover, there's a project option allowing to select layers by their id in OWS Server ‣ WMS capabilities menu of the Project ‣ Project Properties dialog. To activate this option, the checkbox Use layer ids as names has to be selected.

http://localhost/qgisserver?
SERVICE=WMTS
&REQUEST=GetTile
&LAYER=mylayerid1
&...

18.2.2.3.2.4. FORMAT

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

  • jpg

  • jpeg

  • image/jpeg

  • image/png

If the FORMAT parameter is different from one of these values, then the default format PNG is used instead.

18.2.2.3.2.5. TILEMATRIXSET

This parameter defines the CRS to use when computing the underlying pyramid. Format: EPSG:XXXX.

18.2.2.3.2.6. TILEMATRIX

This parameter allows to define the matrix to use for the output tile.

18.2.2.3.2.7. TILEROW

This parameter allows to select the row of the tile to get within the matrix.

18.2.2.3.2.8. TILECOL

This parameter allows to select the column of the tile to get within the matrix.

18.2.2.3.2.9. MAP

This parameter allows to define the QGIS project file to use.

GetMap パラメータテーブル で述べたように、リクエストは実際に動作するためにQGISプロジェクトを必要とするので MAP は必須です。しかし、 QGIS_PROJECT_FILE 環境変数がデフォルトのQGISプロジェクトを定義するために使用されるかもしれません。この場合、 MAP はもはや必須のパラメータではありません。より詳しい情報は 高度な構成 を参照してください。

18.2.2.3.3. GetFeatureInfo

Standard parameters for the GetFeatureInfo request according to the OGC WMTS 1.0.0 specifications:

パラメーター

必須

説明

SERVICE

はい

Name of the service (WMTS)

REQUEST

はい

Name of the request (GetFeatureInfo)

LAYER

はい

Layer identifier

INFOFORMAT

いいえ

出力形式

I

いいえ

X coordinate of a pixel

J

いいえ

Y coordinate of a pixel

TILEMATRIXSET

はい

See GetTile

TILEMATRIX

はい

See GetTile

TILEROW

はい

See GetTile

TILECOL

はい

See GetTile

標準のものに加えて、QGISサーバーでは以下の追加パラメータをサポートしています:

パラメーター

必須

説明

MAP

はい

Specify the QGIS project file

URL example:

http://localhost/qgisserver?
SERVICE=WMTS
&REQUEST=GetFeatureInfo
&MAP=/home/qgis/projects/world.qgs
&LAYER=mylayer
&INFOFORMAT=image/html
&I=10
&J=5

18.2.2.3.3.1. SERVICE

This parameter has to be WMTS in case of the GetFeatureInfo request.

18.2.2.3.3.2. REQUEST

This parameter is GetFeatureInfo in case of the GetFeatureInfo request.

18.2.2.3.3.3. MAP

This parameter allows to define the QGIS project file to use.

GetMap パラメータテーブル で述べたように、リクエストは実際に動作するためにQGISプロジェクトを必要とするので MAP は必須です。しかし、 QGIS_PROJECT_FILE 環境変数がデフォルトのQGISプロジェクトを定義するために使用されるかもしれません。この場合、 MAP はもはや必須のパラメータではありません。より詳しい情報は 高度な構成 を参照してください。

18.2.2.3.3.4. LAYER

This parameter allows to specify the layer to display on the tile.

In addition, QGIS Server introduced some options to select a layer by:

  • a short name

  • the layer id

The short name of a layer may be configured through Properties ‣ Metadata in layer menu. If the short name is defined, then it's used by default instead of the layer's name:

http://localhost/qgisserver?
SERVICE=WMTS
&REQUEST=GetFeatureInfo
&LAYER=mynickname
&...

Moreover, there's a project option allowing to select layers by their id in OWS Server ‣ WMS capabilities menu of the Project ‣ Project Properties dialog. To activate this option, the checkbox Use layer ids as names has to be selected.

http://localhost/qgisserver?
SERVICE=WMTS
&REQUEST=GetFeatureInfo
&LAYER=mylayerid1
&...

18.2.2.3.3.5. INFOFORMAT

This parameter allows to define the output format of the result. Available values are:

  • text/xml

  • text/html

  • text/plain

  • application/vnd.ogc.gml

The default value is text/plain.

18.2.2.3.3.6. I

This parameter allows to define the X coordinate of the pixel for which we want to retrieve underlying information.

18.2.2.3.3.7. J

This parameter allows to define the Y coordinate of the pixel for which we want to retrieve underlying information.

18.2.2.4. WFS3 (OGC API Features)

WFS3 is the first implementation of the new generation of OGC protocols. It is described by the OGC API - Features - Part 1: Core document.

Here is a quick informal summary of the most important differences between the well known WFS protocol and WFS3:

  • WFS3 is based on a REST API

  • WFS3 API must follow the OPENAPI specifications

  • WFS3 supports multiple output formats but it does not dictate any (only GeoJSON and HTML are currently available in QGIS WFS3) and it uses content negotiation to determine which format is to be served to the client

  • JSON and HTML are first class citizens in WFS3

  • WFS3 is self-documenting (through the /api endpoint)

  • WFS3 is fully navigable (through links) and browsable

重要

While the WFS3 implementation in QGIS can make use of the MAP parameter to specify the project file, no extra query parameters are allowed by the OPENAPI specification. For this reason it is strongly recommended that MAP is not exposed in the URL and the project file is specified in the environment by other means (i.e. setting QGIS_PROJECT_FILE in the environment through a web server rewrite rule).

注釈

The API endpoint provides comprehensive documentation of all supported parameters and output formats of your service. The following paragraphs will only describe the most important ones.

18.2.2.4.1. Resource representation

The QGIS Server WFS3 implementation currently supports the following resource representation (output) formats:

  • HTML

  • JSON

The format that is actually served will depend on content negotiation, but a specific format can be explicitly requested by appending a format specifier to the endpoints.

Supported format specifier extensions are:

  • .json

  • .html

Additional format specifier aliases may be defined by specific endpoints:

  • .openapi: alias for .json supported by the API endpoint

  • .geojson: alias for .json supported by the Features and Feature endpoints

18.2.2.4.2. Endpoints

The API provides a list of endpoints that the clients can retrieve. The system is designed in such a way that every response provides a set of links to navigate through all the provided resources.

Endpoints points provided by the QGIS implementation are:

名前

Path

説明

Landing Page

/

General information about the service and provides links to all available endpoints

Conformance

/conformance

Information about the conformance of the service to the standards

API

/api

Full description of the endpoints provided by the service and the returned documents structure

Collections

/collections

List of all collections (i.e. 'vector layers') provided by the service

Collection

/collections/{collectionId}

Information about a collection (name, metadata, extent etc.)

機能

/collections/{collectionId}/items

List of the features provided by the collection

Feature

/collections/{collectionId}/items/{featureId}

Information about a single feature

18.2.2.4.2.1. Landing Page

The main endpoint is the Landing Page. From that page it is possible to navigate to all the available service endpoints. The Landing Page must provide links to

  • the API definition (path /api link relations service-desc and service-doc),

  • the Conformance declaration (path /conformance, link relation conformance), and

  • the Collections (path /collections, link relation data).

../../../../_images/server_wfs3_landing_page.png

図 18.9 Server WFS3 landing page

18.2.2.4.2.2. API Definition

The API Definition is an OPENAPI-compliant description of the API provided by the service. In its HTML representation it is a browsable page where all the endpoints and their response formats are accurately listed and documented. The path of this endpoint is /api.

The API definition provides a comprehensive and authoritative documentation of the service, including all supported parameters and returned formats.

注釈

This endpoint is analogue to WFS's GetCapabilities

18.2.2.4.2.3. Collections list

The collections endpoint provides a list of all the collections available in the service. Since the service "serves" a single QGIS project the collections are the vector layers from the current project (if they were published as WFS in the project properties). The path of this endpoint is /collections/.

../../../../_images/server_wfs3_collections.png

図 18.10 Server WFS3 collections list page

18.2.2.4.2.4. Collection detail

While the collections endpoint does not provide detailed information about each available collection, that information is available in the /collections/{collectionId} endpoints. Typical information includes the extent, a description, CRSs and other metadata.

The HTML representation also provides a browsable map with the available features.

../../../../_images/server_wfs3_collection.png

図 18.11 Server WFS3 collection detail page

18.2.2.4.2.5. Features list

This endpoint provides a list of all features in a collection knowing the collection ID. The path of this endpoint is /collections/{collectionId}/items.

The HTML representation also provides a browsable map with the available features.

注釈

This endpoint is analogue to GetFeature in WFS 1 and WFS 2.

../../../../_images/server_wfs3_features.png

図 18.12 Server WFS3 features list page

18.2.2.4.2.6. Feature detail

This endpoint provides all the available information about a single feature, including the feature attributes and its geometry. The path of this endpoint is /collections/{collectionId}/items/{itemId}.

The HTML representation also provides a browsable map with the feature geometry.

../../../../_images/server_wfs3_feature.png

図 18.13 Server WFS3 feature detail page

18.2.2.4.4. 地物フィルタリング

The features available in a collection can be filtered/searched by specifying one or more filters.

18.2.2.4.4.1. Date and time filter

Collections with date and/or datetime attributes can be filtered by specifying a datetime argument in the query string. By default the first date/datetime field is used for filtering. This behavior can be configured by setting a "Date" or "Time" dimension in the QGIS Server ‣ Dimension section of the layer properties dialog.

The date and time filtering syntax is fully described in the API Definition and also supports ranges (begin and end values are included) in addition to single values.

URL examples:

Returns only the features with date dimension matching 2019-01-01

http://localhost/qgisserver/wfs3/collection_one/items.json?datetime=2019-01-01

Returns only the features with datetime dimension matching 2019-01-01T01:01:01

http://localhost/qgisserver/wfs3/collection_one/items.json?datetime=2019-01-01T01:01:01

Returns only the features with datetime dimension in the range 2019-01-01T01:01:01 - 2019-01-01T12:00:00

http://localhost/qgisserver/wfs3/collection_one/items.json?datetime=2019-01-01T01:01:01/2019-01-01T12:00:00

18.2.2.4.4.2. Bounding box filter

A bounding box spatial filter can be specified with the bbox parameter:

The order of the comma separated elements is:

  • Lower left corner, WGS 84 longitude

  • Lower left corner, WGS 84 latitude

  • Upper right corner, WGS 84 longitude

  • Upper right corner, WGS 84 latitude

注釈

The OGC specifications also allow a 6 item bbox specifier where the third and sixth items are the Z components, this is not yet supported by QGIS server.

URL example:

http://localhost/qgisserver/wfs3/collection_one/items.json?bbox=-180,-90,180,90

If the CRS of the bounding box is not WGS84 (http://www.opengis.net/def/crs/OGC/1.3/CRS84), a different CRS can be specified by using the optional parameter bbox-crs. The CRS format identifier must be in the OGC URI format:

URL example:

http://localhost/qgisserver/wfs3/collection_one/items.json?bbox=913191,5606014,913234,5606029&bbox-crs=http://www.opengis.net/def/crs/EPSG/9.6.2/3857

18.2.2.4.4.3. Attribute filters

Attribute filters can be combined with the bounding box filter and they are in the general form: <attribute name>=<attribute value>. Multiple filters can be combined using the AND operator.

URL example:

filters all features where attribute name equals "my value"

http://localhost/qgisserver/wfs3/collection_one/items.json?attribute_one=my%20value

Partial matches are also supported by using a * ("star") operator:

URL example:

filters all features where attribute name ends with "value"

http://localhost/qgisserver/wfs3/collection_one/items.json?attribute_one=*value

18.2.2.4.5. Attribute selection

The feature attributes returned by a Features list call can be limited by adding a comma separated list of attribute names in the optional properties query string argument.

URL example:

returns only the name attribute

http://localhost/qgisserver/wfs3/collection_one/items.json?properties=name

18.2.2.4.6. Configuration and settings

Server settings recognized by the QGIS WFS3 implementation are:

名前

説明

Default

QGIS_SERVER_API_RESOURCES_DIRECTORY

Base directory for all WFS3 static resources (HTML templates, CSS, JS etc.)

depends on packaging

QGIS_SERVER_API_WFS3_MAX_LIMIT

Maximum value for limit in a features request

10000

18.2.2.4.7. The HTML template language

The HTML representation uses a set of HTML templates to generate the response. The template is parsed by a template engine called inja. The templates can be customized by overriding them (see: Template overrides). The template has access to the same data that are available to the JSON representation and a few additional functions are available to the template:

18.2.2.4.7.1. Custom template functions

  • path_append( path ): appends a directory path to the current url

  • path_chomp( n ): removes the specified number "n" of directory components from the current url path

  • json_dump( ): prints the JSON data passed to the template

  • static( path ): returns the full URL to the specified static path. For example: "static( "/style/black.css" )" with a root path "http://localhost/qgisserver/wfs3" will return "http://localhost/qgisserver/wfs3/static/style/black.css".

  • links_filter( links, key, value ): Returns filtered links from a link list

  • content_type_name( content_type ): Returns a short name from a content type, for example "text/html" will return "HTML"

18.2.2.4.7.2. Template overrides

Templates and static assets are stored in subdirectories of the QGIS server default API resource directory (/usr/share/qgis/resources/server/api/ on a Linux system), the base directory can be customized by changing the environment variable QGIS_SERVER_API_RESOURCES_DIRECTORY.

A typical Linux installation will have the following directory tree:

/usr/share/qgis/resources/server/api/
└── ogc
    ├── schema.json
    ├── static
    │   ├── jsonFormatter.min.css
    │   ├── jsonFormatter.min.js
    │   └── style.css
    └── templates
        └── wfs3
            ├── describeCollection.html
            ├── describeCollections.html
            ├── footer.html
            ├── getApiDescription.html
            ├── getFeature.html
            ├── getFeatures.html
            ├── getLandingPage.html
            ├── getRequirementClasses.html
            ├── header.html
            ├── leaflet_map.html
            └── links.html

To override the templates you can copy the whole tree to another location and point QGIS_SERVER_API_RESOURCES_DIRECTORY to the new location.

18.2.2.5. すべてのリクエストタイプでサポートされている追加パラメーター

The following extra parameters are supported by all protocols.

  • FILE_NAME: if set, the server response will be sent to the client as a file attachment with the specified file name.

注釈

Not available for WFS3.

  • MAP: Similar to MapServer, the MAP parameter can be used to specify the path to the QGIS project file. You can specify an absolute path or a path relative to the location of the server executable (qgis_mapserv.fcgi). If not specified, QGIS Server searches for .qgs files in the directory where the server executable is located.

    例:

    http://localhost/cgi-bin/qgis_mapserv.fcgi?\
      REQUEST=GetMap&MAP=/home/qgis/projects/world.qgs&...
    

注釈

QGISプロジェクトファイルをどこで検索するかをサーバーの実行可能ファイルに伝えるために、環境変数として QGIS_PROJECT_FILE を定義できます。この変数はQGISによってプロジェクトファイルが探される場所になります。定義されていない場合はリクエスト中のMAPパラメーターを使用し、最終的にはサーバーの実行可能ファイルのディレクトリを見ていきます。

18.2.2.6. REDLINING

この機能は利用可能であり、 GetMap および GetPrint 要求と共に使用できます。

赤線引き地物は、リクエスト中のジオメトリとラベルに渡すのに使用できます、標準返された画像(地図)上でサーバーによって重ねあわされます。これにより、ユーザーは、標準地図にないいくつかの領域、場所などに強調(emphasis)またはコメント(ラベル)を追加することが可能になります。

要求は以下の形式で行われます。

http://qgisplatform.demo/cgi-bin/qgis_mapserv.fcgi?map=/world.qgs&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

ポリゴンとラベルが通常地図の上に描かれている、上記の要求によって出力された画像は次のとおりです:

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

図 18.14 レッドラインパラメーターを持つGetMapリクエストに対するサーバーの応答

このリクエストにはいくつかのパラメーターがあります。

  • HIGHLIGHT_GEOM: You can add POINT, MULTILINESTRING, POLYGON etc. It supports multipart geometries. Here is an example: HIGHLIGHT_GEOM=MULTILINESTRING((0 0, 0 1, 1 1)). The coordinates should be in the CRS of the GetMap/GetPrint request.

  • HIGHLIGHT_SYMBOL :ジオメトリの輪郭をどのように表示するかを制御し、ストロークの幅、色、不透明度を変更できます。

  • HIGHLIGHT_LABELSTRING :ラベルのテキストをこのパラメーターに渡すことができます。

  • HIGHLIGHT_LABELSIZE: このパラメーターは、ラベルのサイズを制御します。

  • HIGHLIGHT_LABELCOLOR: このパラメーターは、ラベルの色を制御します。

  • HIGHLIGHT_LABELBUFFERCOLOR: このパラメーターは、ラベルバッファの色を制御します。

  • HIGHLIGHT_LABELBUFFERSIZE: このパラメーターは、ラベルバッファのサイズを制御します。

18.2.2.7. External WMS layers

QGISサーバは、WMS GetMapとWMS GetPrintリクエストに外部WMSサーバからのレイヤを含めることを可能にします。これは、WebクライアントがWeb地図で外部の背景レイヤを使用している場合に特に便利です。パフォーマンス上の理由から、このようなレイヤはWebクライアントから直接要求される必要があります(QGISサーバを介してカスケードされることはありません)。ただし、印刷する場合は、印刷された地図に表示されるように、これらのレイヤーをQGISサーバ経由でカスケードする必要があります。

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
&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>
&basemap:url=http://externalserver.com/wms.fcgi
&basemap:format=image/jpeg
&basemap:dpiMode=7
&basemap:crs=EPSG:2056
&basemap:layers=orthofoto
&basemap:styles=default