서비스

QGIS Server is able to serve data according to standard protocols as described by the Open Geospatial Consortium (OGC):

  • WMS 1.1.0 and 1.3.0

  • WFS 1.0.0 and 1.1.0

  • WCS 1.1.1

  • WMTS 1.0.0

Extra vendor parameters and requests are supported in addition to the original standard that greatly enhance the possibilities of customizing its behavior thanks to the QGIS rendering engine.

WMS(웹 맵 서비스)

The 1.1.0 and 1.3.0 WMS standards implemented in QGIS Server provide a HTTP interface to request map or legend images generated from a QGIS project. A typical WMS request defines the QGIS project to use, the layers to render as well as the image format to generate. Basic support is also available for the Styled Layer Descriptor (SLD) standard.

Specifications document according to the version number of the service:

Standard requests provided by QGIS Server:

Request

Description

GetCapabilities

Return XML metadata with information about the server

GetMap

Return a map

GetFeatureInfo

Retrieves data (geometry and values) for a pixel location

GetLegendGraphics

Returns legend symbols


Vendor requests provided by QGIS Server:

Request

Description

GetPrint

Returns a QGIS composition

GetProjectSettings

Returns specific information about QGIS Server

GetMap

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

Parameter

Required

Description

SERVICE

Yes

Name of the service (WMS)

VERSION

No

Version of the service

REQUEST

Yes

Name of the request (GetMap)

LAYERS

No

Layers to display

STYLES

No

Layers〉 style

SRS / CRS

Yes

Coordinate reference system

BBOX

No

Map extent

WIDTH

Yes

Width of the image in pixels

HEIGHT

Yes

Height of the image in pixels

FORMAT

No

Image format

TRANSPARENT

No

Transparent background


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

Parameter

Required

Description

MAP

Yes

Specify the QGIS project file

BGCOLOR

No

Specify the background color

DPI

No

Specify the output resolution

IMAGE_QUALITY

No

JPEG compression

OPACITIES

No

Opacity for layer or group

FILTER

No

Subset of features

SELECTION

No

Highlight features

FILE_NAME

No

Only for FORMAT=application/dxf

File name of the downloaded file

FORMAT_OPTIONS

No

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:NOSYMBOLOGY|FEATURESYMBOLOGY|SYMBOLLAYERSYMBOLOGY: corresponds to the three export options offered in the QGIS Desktop DXF export dialog.

  • LAYERSATTRIBUTES:yourcolumn_with_values_to_be_used_for_dxf_layernames 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.


URL example:

http://localhost/qgis_server?
SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetMap
&MAP=/home/user/project.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

SERVICE

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

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

REQUEST

This parameter is GetMap in case of the GetMap request.

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/qgis_server?
SERVICE=WMS
&REQUEST=GetMap
&LAYERS=mynickname1,mynickname2
&...

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

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

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.

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/qgis_server?
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/qgis_server?
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/qgis_server?
SERVICE=WMS
&REQUEST=GetMap
&VERSION=1.3.0
&CRS=EPSG:4326
&SRS=EPSG:2854
&...

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. Actually, in WMS 1.1.0, coordinates are formed like minx,miny,maxx,maxy or minlong,minlat,maxlong,maxlat. For example:

http://localhost/qgis_server?
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/qgis_server?
SERVICE=WMS
&REQUEST=GetMap
&VERSION=1.3.0
&CRS=epsg:4326
&BBOX=-90,-180,90,180
&...

WIDTH

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

HEIGHT

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

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/qgis_server?
    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
    

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.

MAP

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

As mentioned in GetMap parameters table, MAP is mandatory because a request needs a QGIS project to actually work. However, the QGIS_PROJECT_FILE environment variable may be used to define a default QGIS project. In this specific case, MAP is not longer a required parameter. For further information you may refer to 고급 환경 설정.

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/qgis_server?
SERVICE=WMS
&REQUEST=GetMap
&VERSION=1.3.0
&BGCOLOR=green
&...

URL example with the hexadecimal notation:

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

DPI

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

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.

OPACITIES

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

FILTER

A subset of layers can be selected with the FILTER parameter. 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/qgis_server?
SERVICE=WMS
&REQUEST=GetMap
&LAYERS=mylayer1,mylayer2
&FILTER=mylayer1:"OBJECTID" = 3;mylayer2:'text' = 'blabla'
&...

참고

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.

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/qgis_server?
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

SELECTION 파라미터를 보유한 GetMap 요청에 대한 서버의 응답

GetFeatureInfo

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

Parameter

Required

Description

SERVICE

Yes

Name of the service (WMS)

VERSION

No

See GetMap

REQUEST

Yes

See GetMap

LAYERS

No

See GetMap

STYLES

No

See GetMap

SRS / CRS

Yes

See GetMap

BBOX

No

See GetMap

WIDTH

Yes

See GetMap

HEIGHT

Yes

See GetMap

TRANSPARENT

No

See GetMap

INFO_FORMAT

No

Output format

QUERY_LAYERS

Yes

Layers to query

FEATURE_COUNT

No

Maximum number of features to return

I

No

Pixel column of the point to query

X

No

Same as I parameter, but in WMS 1.1.0

J

No

Pixel row of the point to query

Y

No

Same as J parameter, but in WMS 1.1.0


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

Parameter

Required

Description

MAP

Yes

See GetMap

FILTER

No

See GetMap

FI_POINT_TOLERANCE

No

Tolerance in pixels for point layers

FI_LINE_TOLERANCE

No

Tolerance in pixels for line layers

FI_POLYGON_TOLERANCE

No

Tolerance in pixels for polygon layers

FILTER_GEOM

No

Geometry filtering

WITH_MAPTIP

No

Add map tips to the output

WITH_GEOMETRY

No

Add geometry to the output


URL example:

http://localhost/qgis_server?
SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetMap
&MAP=/home/user/project.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

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

  • text/xml

  • text/html

  • text/plain

  • application/vnd.ogc.gml

  • application/json

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.

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 maximun of 3 features from layer2 will be returned.

By default, only 1 feature per layer is returned.

I

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

X

Same parameter as I, but defined in WMS 1.1.0.

J

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

Y

Same parameter as J, but defined in WMS 1.1.0.

FI_POINT_TOLERANCE

This parameter specifies the tolerance in pixels for point layers.

FI_LINE_TOLERANCE

This parameter specifies the tolerance in pixels for line layers.

FI_POLYGON_TOLERANCE

This parameter specifies the tolerance in pixels for polygon layers.

FILTER_GEOM

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

WITH_MAPTIP

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

Available values are (not case sensitive):

  • TRUE

  • FALSE

WITH_GEOMETRY

This parameter specifies whether to add geometries to the output.

Available values are (not case sensitive):

  • TRUE

  • FALSE

GetPrint

QGIS Server has the capability to create print layout output in pdf or pixel format. Print layout windows in the published project are used as templates. In the GetPrint request, the client has the possibility to specify parameters of the contained layout maps and labels.

Parameters for the GetPrint request:

Parameter

Required

Description

MAP

Yes

Specify the QGIS project file

SERVICE

Yes

Name of the service (WMS)

VERSION

No

See GetMap

REQUEST

Yes

Name of the request (GetPrint)

LAYERS

No

See GetMap

TEMPLATE

Yes

Layout template to use

SRS / CRS

Yes

See GetMap

FORMAT

Yes

Output format

STYLES

No

See GetMap

TRANSPARENT

No

See GetMap

OPACITIES

No

See GetMap

SELECTION

No

See GetMap

mapX:EXTENT

No

Extent of the map 〈X〉

mapX:LAYERS

No

Layers of the map 〈X〉

mapX:STYLES

No

Layers〉 style of the map 〈X〉

mapX:SCALE

No

Layers〉 scale of the map 〈X〉

mapX:ROTATION

No

Rotation of the map 〈X〉

mapX:GRID_INTERVAL_X

No

Grid interval on x axis of the map 〈X〉

mapX:GRID_INTERVAL_Y

No

Grid interval on y axis of the map 〈X〉


URL example:

http://localhost/qgis_server?
SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetPrint
&MAP=/home/user/project.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

Note that the layout template may contain more than one map. In this way, if you want to configure a specific map, you have to use mapX: parameters where X is a positive number that you can retrieve thanks to the GetProjectSettings request.

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>

SERVICE

This parameter has to be WMS.

REQUEST

This parameter has to be GetPrint for the GetPrint request.

TEMPLATE

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

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.

mapX:EXTENT

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

mapX:ROTATION

This parameter specifies the map rotation in degrees.

mapX:GRID_INTERVAL_X

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

mapX:GRID_INTERVAL_Y

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

mapX:SCALE

This parameter specifies the map scale for a layout map item. This is useful to ensure scale based visibility of layers and labels even if client and server may have different algorithms to calculate the scale denominator.

mapX:LAYERS

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

mapX:STYLES

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

GetLegendGraphics

다음은 범례 항목의 크기를 변경하는 데 사용할 수 있는 여러 추가 파라미터들입니다:

  • BOXSPACE 파라미터: 범례 프레임과 내용물 사이의 여백을 밀리미터 단위로 정의합니다.

  • LAYERSPACE vertical space between layers (mm)

  • LAYERTITLESPACE 파라미터: 레이어 제목과 그 옆에 있는 항목들 사이의 수직 여백을 밀리미터 단위로 정의합니다.

  • SYMBOLSPACE 파라미터: 심볼과 그 옆에 있는 항목 사이의 수직 여백을 밀리미터 단위로 정의합니다.

  • ICONLABELSPACE 파라미터: 심볼과 라벨 텍스트 사이의 수평 여백을 밀리미터 단위로 정의합니다.

  • SYMBOLWIDTH 파라미터: 심볼 미리보기의 너비를 밀리미터 단위로 정의합니다.

  • SYMBOLHEIGHT 파라미터: 심볼 미리보기의 높이를 밀리미터 단위로 정의합니다.

다음은 레이어 제목 및 항목 라벨의 폰트 속성을 변경하는 파라미터들입니다:

  • 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 / RULELABEL set them to FALSE to get only the legend graphics without labels

Content based legend. These parameters let the client request a legend showing only the symbols for the features falling into the requested area:

  • 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

GetProjectSettings

이 요청 유형은 GetCapabilities 요청과 비슷하게 동작하지만, 좀 더 QGIS 서버에 특화돼 있고 클라이언트가 GetCapabilities 출력물에서는 볼 수 없는 다음 추가 정보를 읽을 수 있습니다:

  • 레이어의 초기 가시성

  • 벡터 속성 및 속성 편집 유형 관련 정보

  • 레이어 순서 및 렌더링 순서 관련 정보

  • WFS에 게시된 레이어 목록

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

Description

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

GetFeature

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

Parameter

Required

Description

SERVICE

Yes

Name of the service

VERSION

No

Version of the service

REQUEST

Yes

Name of the request

TYPENAME

No

Name of layers

OUTPUTFORMAT

No

Output Format

RESULTTYPE

No

Type of the result

PROPERTYNAME

No

Name of properties to return

MAXFEATURES

No

Maximum number of features to return

SRSNAME

No

Coordinate reference system

FEATUREID

No

Filter the features by ids

FILTER

No

OGC Filter Encoding

BBOX

No

Map Extent

SORTBY

No

Sort the results


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

Parameter

Required

Description

MAP

Yes

Specify the QGIS project file

STARTINDEX

No

Paging

GEOMETRYNAME

No

Type of geometry to return

EXP_FILTER

No

Expression filtering

SERVICE

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

For example:

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

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/qgis_server?
SERVICE=WFS
&VERSION=1.1.0
&...

REQUEST

This parameter is GetFeature in case of the GetFeature request.

URL example:

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

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/qgis_server?
SERVICE=WFS
&VERSION=1.1.0
&REQUEST=GetFeature
&RESULTTYPE=hits
&...

GEOMETRYNAME

This parameter can be used to specify the kind of geometry to return for features. Available values are:

  • extent

  • centroid

  • none

URL example:

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

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/qgis_server?
SERVICE=WFS
&VERSION=1.1.0
&REQUEST=GetFeature
&STARTINDEX=2
&...

Web Map Tile Service (WMTS)

The 1.0.0 WMTS standard implemented in QGIS Server provides a HTTP interface to request tiled map images generated from a QGIS project. A typical WMTS request defined the QGIS project to use, some WMS parameters like layers to render, as well as tile parameters.

Specifications document of the service:

Standard requests provided by QGIS Server:

Request

Description

GetCapabilities

Returns XML metadata with information about the server

GetTile

Returns a tile

GetFeatureInfo

Retrieves data (geometry and values) for a pixel location

GetCapabilities

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

Parameter

Required

Description

SERVICE

Yes

Name of the service (WMTS)

REQUEST

Yes

Name of the request (GetCapabilities)


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

Parameter

Required

Description

MAP

Yes

Specify the QGIS project file


URL example:

http://localhost/qgis_server?
SERVICE=WMTS
&REQUEST=GetCapabilities
&MAP=/home/user/project.qgs

SERVICE

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

REQUEST

This parameter is GetCapabilities in case of the GetCapabilities request.

MAP

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

GetTile

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

Parameter

Required

Description

SERVICE

Yes

Name of the service (WMTS)

REQUEST

Yes

Name of the request (GetTile)

LAYER

Yes

Layer identifier

FORMAT

Yes

Output format of the tile

TILEMATRIXSET

Yes

Name of the pyramid

TILEMATRIX

Yes

Meshing

TILEROW

Yes

Row coordinate in the mesh

TILECOL

Yes

Column coordinate in the mesh


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

Parameter

Required

Description

MAP

Yes

Specify the QGIS project file


URL example:

http://localhost/qgis_server?
SERVICE=WMTS
&REQUEST=GetTile
&MAP=/home/user/project.qgs
&LAYER=mylayer
&FORMAT=image/png
&TILEMATRIXSET=EPSG:4326
&TILEROW=0
&TILECOL=0

SERVICE

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

REQUEST

This parameter is GetTile in case of the GetTile request.

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/qgis_server?
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/qgis_server?
SERVICE=WMTS
&REQUEST=GetTile
&LAYER=mylayerid1
&...

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.

TILEMATRIXSET

This parameter allows to define the CRS to use to compute the underlying pyramid and has to be formed like EPSG:XXXX.

TILEMATRIX

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

TILEROW

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

TILECOL

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

MAP

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

As mentioned in GetMap parameters table, MAP is mandatory because a request needs a QGIS project to actually work. However, the QGIS_PROJECT_FILE environment variable may be used to define a default QGIS project. In this specific case, MAP is not longer a required parameter. For further information you may refer to 고급 환경 설정.

GetFeatureInfo

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

Parameter

Required

Description

SERVICE

Yes

Name of the service (WMTS)

REQUEST

Yes

Name of the request (GetFeatureInfo)

LAYER

Yes

Layer identifier

INFOFORMAT

No

Output format

I

No

X coordinate of a pixel

J

No

Y coordinate of a pixel

TILEMATRIXSET

Yes

See GetTile

TILEMATRIX

Yes

See GetTile

TILEROW

Yes

See GetTile

TILECOL

Yes

See GetTile


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

Parameter

Required

Description

MAP

Yes

Specify the QGIS project file


URL example:

http://localhost/qgis_server?
SERVICE=WMTS
&REQUEST=GetFeatureInfo
&MAP=/home/user/project.qgs
&LAYER=mylayer
&INFOFORMAT=image/html
&I=10
&J=5

SERVICE

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

REQUEST

This parameter is GetFeatureInfo in case of the GetFeatureInfo request.

MAP

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

As mentioned in GetMap parameters table, MAP is mandatory because a request needs a QGIS project to actually work. However, the QGIS_PROJECT_FILE environment variable may be used to define a default QGIS project. In this specific case, MAP is not longer a required parameter. For further information you may refer to 고급 환경 설정.

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/qgis_server?
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/qgis_server?
SERVICE=WMTS
&REQUEST=GetFeatureInfo
&LAYER=mylayerid1
&...

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.

I

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

J

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

모든 요청 유형이 지원하는 추가 파라미터들

  • FILE_NAME 파라미터: 이 파라미터를 설정하면, 서버가 클라이언트에게 설정한 파일명을 가진 첨부 파일로 응답을 넘깁니다.

  • MAP 파라미터: 맵서버와 비슷하게, QGIS 프로젝트 파일을 가리키는 경로를 지정하는 데 MAP 파라미터를 사용할 수 있습니다. 절대 경로를 지정할 수도 있고, 서버 실행 파일(qgis_mapserv.fcgi)의 위치를 기준으로 하는 상대 경로를 지정할 수도 있습니다. 이 파라미터를 설정하지 않으면, QGIS는 서버 실행 파일이 위치한 디렉터리에서 .qgs 파일을 검색할 것입니다.

    다음은 그 예시입니다:

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

참고

QGIS_PROJECT_FILE 파라미터를 환경 변수로 정의해서 서버 실행 파일에 QGIS 프로젝트 파일을 찾을 수 있는 위치를 알려줄 수 있습니다. 이 변수가 QGIS가 프로젝트 파일을 검색할 위치가 될 것입니다. 정의하지 않을 경우, 요청에 있는 MAP 파라미터를 이용한 다음 마지막으로 서버 실행 파일이 있는 디렉터리를 살펴볼 것입니다.

REDLINING(특정 경계 지역 지정)

GetMapGetPrint 요청을 통해 이 기능을 사용할 수 있습니다.

요청 안에 있는, 서버가 반환한 표준 이미지(맵) 위를 중첩시키도록하는 도형 및 라벨을 넘기는 데 이 REDLINING 기능을 사용할 수 있습니다. 이 기능은 사용자가 표준 맵에는 없는 일부 지역 또는 위치 등을 강조하거나 또는 그런 곳에 주석(라벨)을 달 수 있도록 해줍니다.

다음과 같은 서식으로 요청합니다:

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

REDLINING 파라미터를 보유한 GetMap 요청에 대한 서버의 응답

이 요청 안에 다음 여러 파라미터들이 있다는 것을 알 수 있습니다:

  • HIGHLIGHT_GEOM 파라미터: 포인트, 멀티라인스트링, 폴리곤 등을 추가할 수 있습니다. 다중 부분 도형도 지원합니다. 이 파라미터는 HIGHLIGHT_GEOM=MULTILINESTRING((0 0, 0 1, 1 1)) 와 같이 사용할 수 있습니다. 사용 좌표는 GetMap / GetPrint 요청의 좌표계의 좌표여야 합니다.

  • HIGHLIGHT_SYMBOL 파라미터: 이 파라미터는 도형의 외곽선을 어떻게 렌더링할지 제어하며, 사용자가 획의 너비, 색상 및 불투명도를 변경할 수 있습니다.

  • HIGHLIGHT_LABELSTRING 파라미터: 이 파라미터를 통해 사용자의 라벨 텍스트를 넘겨줄 수 있습니다.

  • HIGHLIGHT_LABELSIZE 파라미터: 이 파라미터는 라벨의 크기를 제어합니다.

  • HIGHLIGHT_LABELCOLOR 파라미터: 이 파라미터는 라벨의 색상을 제어합니다.

  • HIGHLIGHT_LABELBUFFERCOLOR 파라미터: 이 파라미터는 라벨 버퍼의 색상을 제어합니다.

  • HIGHLIGHT_LABELBUFFERSIZE 파라미터: 이 파라미터는 라벨 버퍼의 크기를 제어합니다.

External WMS layers

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/qgis_server?
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/qgis_server?
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